- I found I could solve the error by changing the ADO reference to a different version, say from 2.5 to 2.8, and/or back again, and then recompiling the database, but that got tedious.
- Here's an article at Microsoft that explains what is going on.
- Here's the code I run at startup that resets the reference to 2.8, which shipped with XP, and it seems to have solved the problem for me...
Private Sub ResetADOReference()Article: Breaking change in MDAC ADODB COM components in Windows 7
On Error GoTo handler
'remove ref, raises err 9 if not present
References.Remove References("ADODB")
'add reference
'References.AddFromGuid "{00000206-0000-0010-8000-00AA006D2EA4}", 2, 6
References.AddFromGuid "{2A75196C-D9EB-4129-B803-931327F72D5C}", 2, 8
Exit Sub
handler:
If err = 9 Then
'subscript out of range
Resume Next
Else
MsgBox err & " " & err.Description & vbCrLf & _
"ADODB reference may be broken.", vbExclamation
End If
End Sub
No comments:
Post a Comment