Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I am having a library problem. I we

Status
Not open for further replies.

ProgrammingB52

Technical User
May 7, 2003
37
US
I am having a library problem. I went to tools->references and dont which libraries to use. It compiled and ran fine before, but all of a sudden it doesn't recognize ADODB.Recordset and CurrentProject.Connection

Public Sub removedashUPClist()
Dim cnn As Connection
Dim rst As ADODB.Recordset
Set cnn = CurrentProject.Connection
Set rst = New ADODB.Recordset
rst.Open "currentTbl" cnn, adOpenKeyset, adLockOptimistic
cnn.Close
End Sub

With Set rst = New ADODB.Recordset
I got "compile error: User-defined function not defined"
Then I changed the library, took out the DAO library.
Then I got runtime error "type mismatch" with the statement
Set cnn = CurrentProject.Connection. What library's do I need to be using, or what shouldn't I be using?
 


Hi:

For ADODB, one should use Microsoft ActiveX Data Objects 2.x Library, where x is 5 or later.

One error that was obvious is
Code:
rst.Open "currentTbl"  cnn, adOpenKeyset, adLockOptimistic
should have a comma before the cnn, like
Code:
rst.Open "currentTbl",  cnn, adOpenKeyset, adLockOptimistic
Cassie
 
Well, I did use the comma for my module. I am using Microsoft ActiveX Data Objects (MultiDimensional 2.5)
and Microsoft ActiveX Data Objects 2.0. This code works, then when reopening it suddenly doesn't have the correct libraries.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top