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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code to Create Connection

Status
Not open for further replies.

MikeRBS

IS-IT--Management
Apr 15, 2004
81
0
0
GB
I've got this code

Sub AssignAtlas()

'Add incrementing Atlas numbers to those items without a number currently

Const CONNECT_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=g:\Inventory\InvHPD.mdb"

Dim Connection As New ADODB.Connection
Dim RS1 As New ADODB.Recordset

etc...

When I try to run the code, Connection As New ADODB.Connection gets highlighted and the message is

Compile Error

User-defined type not defined.


Any suggestions what I'm doing wrong?
 
I'd check/do two things
1 - ensure you have a valid reference to ADO
2 - use something other than a reserwed word for variable name (cn, con, mycon...)

Roy-Vidar
 
Hi Roy.

I just checked and it looks as though the ADO library was not activated whereas DAO was. Bizarre set-up as this is Access 2002, so I would have thought it would default to ADO.

Thanks for your help.

Mike
 
If the database is converted from 97, then it's expected. When creating new databases, you are correct, ADO would be default (and in 2003, both are default when creating new databases;-))

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top