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

Making a connection to a database

Status
Not open for further replies.

Driep

MIS
Jul 11, 2003
11
ZA
Hi,

I am running Microsoft Access 2000 (9.0.3821 SR-1).

It is some time since I have done some programming in Access and that was in Access 97.

When I wanted to connect to a database I used the following code:
...
Dim MyDB As Database
Dim MyData As Recordset
...
Set MyDB = DBEngine.Workspaces(0).Databases(0)
Set MyData = MyDB.OpenRecordset("STUD_IAHSUB", DB_OPEN_SNAPSHOT)
...

Now in Access 2000 I get an error message on '... MyDB As Database' that 'User-Defined type not defined'.

Even in the help of Access 2000 this is the method shown to define a database object.

Can someone give me a hint of how to change my coding ?

Have a nice day.

Driep
 
It might be a reference problem in earlier versions of Access DAO was norm now it is ADO you might to look in your references and make sure that the DAO 3.6 in referenced and also declare the db as DAO DB

Hope this helps
Hymn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top