ODBC connnection

D

Dave

I have a form that runs a sub to connect to a remote server with the
following script:
Private Sub MLP_Proc_Click()
' declare and instantiate the object variables
Dim cnMarvin As Connection
Set cnMarvin = New Connection
Dim rsMLP As Recordset
Set rsMLP = New Recordset
Dim comExecute As Command
Set comExecute = New Command

It works fine in the original form. If I make a new form (in another
database) and copy the script to the new form and executing the script it
fails with the message: "Compile error - Invalid use of New Keyword" and
highlites "New Connection" part of the script.

Is there something else I should be duplicating to the new form?
 
A

Albert D. Kallal

Take a look at the references in your regional database, I suspect you're
using access 2000, or perhaps 2002?

you need a reference to the dao 3.6 object library....

going to the original database, and while viewing code (ctrl-g), then go
tools ->references.

that check your second database, I suspect that you're missing some
references there.

if the references by chance happen to be the same, then you'll have to move
up the dao libary in your 2nd database.....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top