ODBC connnection

  • Thread starter Thread starter Dave
  • Start date Start date
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?
 
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.....
 
Back
Top