I am working with a legacy database .mdb database that just crashes in Access 2007 when it hits lines with CurrentProject.Connection in them.
When I add the same code to brand new databases it crashes them too.
Dim rstDateFields As New adodb.Recordset
rstDateFields.Open "SELECT * FROM defDateFields ORDER BY FieldID", CurrentProject.Connection, adOpenDynamic, adLockOptimistic
References set to: VBA, MS ACCESS 12.0 object library, OLE automation, MS Ofrfice 14.0 Access db engine object
The code you showed us was very basic ADO, so it’s hard to believe the code itself is the cause of the problem. Check whether the problem is isolated to that one machine by trying the same code from another machine. If it runs without error there, mostly likely the original machine is broken somehow. Unfortunately trying to find and fix the breakage can be challenging. Good luck!