Is there a simple way to connect to a recordset in Access2000

  • Thread starter Thread starter RobertC
  • Start date Start date
R

RobertC

Guest
I am writing a program to be used on stand alone computers at different locations. Is there a simple way in Access 2000 to connect to the current database like there was in Access 97.

In Access 97, I was able to dimension the database and then use a simple:
Set dbs = CurrentDb()
to connect to a database to open a recordset.

In Access 2000 the only way I have been able to get it to work has been to use code like the following:

' Open a connection using the Microsoft Jet Provider.
Set cnntmp = New ADODB.Connection
cnntmp.Provider = "Microsoft.Jet.oledb.4.0"
cnntmp.Open "C:\DATA\DB\WellHistory.MDB", "admin", ""

This requires knowing the Jet engine version and the file location which I will not have control of when users install on their PC's.

Any help would be appreciated. Thanks in advance.
 
The syntax is slightly different in A2K.

Dim dbs As ADODB.Connection, rst as ADODB.Recordset

Set dbs = CurrentProject.Connection
Set rst = New ADODB.Recordset

rst.Open "YourTable", dbs, adOpenDynamic, adLockOptimistic

etc.

Hope that helps
 
You can still use DAO in an A2K database. Just add a reference to the DAO library 3.6 and qualify all your DAO objects to avoid confusion with similarly named ADO objects.

Dim db as DAO.Database
Dim rs as DAO.Recordset
etc.
 

Users who are viewing this thread

Back
Top Bottom