1

In the "old" days, in order for me to search a "Table" for specific data in a vba statement in a "Form"/"Event" in MS Access 2003, that I chose. I would use the following code:


Set Table_ID = New ADODB.Recordset

Table_ID.CursorLocation = adUseClient

Table_ID.Open "Select * From Table_ID", _

  CurrentProject.Connection, adOpenDynamic, adLockOptimistic

The above code gives me the following message when I ran it MS Access 2019:

Microsoft Visual Basic for Application Compile error: User-defined type not defined

I changed the "ADODB" with the database I'm using in MS Access 2019 as follows:

Set Table_ID = New DB002.Recordset

When I ran it again in MS Access 2019, the same message appeared.

Please advise.

braX
  • 11,506
  • 5
  • 20
  • 33
Burt
  • 11
  • 2
  • https://stackoverflow.com/questions/9737099/difference-between-ado-and-dao – braX May 05 '22 at 06:24
  • 1
    For ADODB, probably need to activate Microsoft ActiveX Data x.x Objects Library reference from the VBA editor Tools > References. I have never seen DB002. – June7 May 05 '22 at 14:26
  • 1
    What are you doing with this recordset? Maybe instead of opening recordset, just use DLookup() domain aggregate function. – June7 May 05 '22 at 14:41

0 Answers0