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

Problems with OpenRecordSet in Access 2000.

Status
Not open for further replies.

Sanibel

Technical User
Joined
Nov 15, 2001
Messages
73
Location
GB
I am trying to connect to an Access 2000 database using code which was originally written for Access 97

The code is similar to
Dim DB As Database
Dim RS As Recordset
Set DB=DBEngine.Workspace(0).Databases(0)
Set RS=DB.OpenRecordset("SQL string",DB_OPEN_DYNASET)

I originally had an error "User-defined type not defined" on the Dim DB As Database line and overcame this be enabling the Microsoft DAO 3.6 Object Library.

I now get the error "Method or data member not found" on the
Set RS=DB.OpenRecordset("SQL string",DB_OPEN_DYNASET) line.

I guess there's another Reference that I need to enable/disable.

Does anyone know how I overcome this problem.

Thanks
 
Dim RS As [highlight]DAO.[/highlight]Recordset

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Also do explicit declaration of DAO objects:

[tt] Dim DB As dao.Database
Dim RS As dao.Recordset[/tt]

Roy-Vidar
 
Thanks, but I've already had a go at explicitly defining the DAO without any success. Any more ideas.
 

sould it not be vbOpenDynaset?
 
dbOpenDynaset - but the "old" thingies that are kept for backward compatibility, still works (they are members of the Access.OldConstants class ;-), whilst the .OpenRecordset method is not a member of the recordset object of the default library when using a2k+ (which is ADO), unless one has toggled the references, and dares to rely upon that...).

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top