compile error... ADODB connection

I

ina

Hello all,

I have a problem with the ADODB connection... and I do not understand
because yesteday worked fine and today not.

I have this mistake ...

compile error, User-defined type not defined

This is my code

Sub test()

'---------------------------------------
'Connection to sql server
'---------------------------------------
'Set up a connection
Set Cnx = New ADODB.Connection

Dim cmd As ADODB.Command ...

Thanks,

ina
 
J

Jim Thomlinson

As a guess you have not got a reference to the ADODB library. Look in Tools
-> References for an item marked as missing "Missing: Microsoft ActiveX Data
Objects..." Uncheck this item and find a version of that library that you do
have.

As an aside, you should declare your connection object with a dim statement
something like this...

Sub test()
Dim Cnx as ADODB.Connection
'---------------------------------------
'Connection to sql server
'---------------------------------------
'Set up a connection
Set Cnx = New ADODB.Connection

Dim cmd As ADODB.Command ...
 

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