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

Access 97 Question

Status
Not open for further replies.

solo7

Technical User
Mar 14, 2001
243
NO
I have completed a project in Access 2K and I have 'converted to a prior version' ie Access 97 using the wizard. In doing this I have encountered an error whilst using a section DAO record search :-

Dim Rs1 As New ADODB.Recordset
Dim cnn As ADODB.Connection
Dim StrSQL, StrDteA As String
Dim DteLow(6) As Date
Dim IntA, IntB, IntC As Integer

'start search
Set Rs1 = New ADODB.Recordset
Set cnn = CurrentProject.Connection

my program errors out on the last line above with the CurrentProject highlited.

It works fine in 2K so is there any way I can emulate the CurrentProject connection ?? to make it run in '97.
Maybe I'm just missing a refference, but the object browser doesn't pick it up !

Steady ... [thumbsup2]
 
The following code works with DAO...I'm really not positive about ADODB, but, as a wise Access guru (Helen Feddema) once said.."There are 3 or more ways to do everything in Access!!" ... so, here goes!

Create yourself a database variable (I normally call it dbs), and then set it to the current database using the following syntax: Set dbs = CurrentDb

And then, open your recordset using the following syntax:
Set rs1 = dbs.OpenRecordset(<recordset name here>)

Et voila! You may have to make some minor changes to code here and there, but this should work.

HTH

Greg Tammi, ATS Alarm Supervisor
E-mail: gtammi@atsbell.com
 
The reference library is
Microsoft ActiveX data objects 2.6 library

This ADO library is the default library in Access 2000, but in Access 97 it is probably DAO 3.6 or some equivelant.

I don't know if ADO works with Access 97, you may need to go back to using DAO libraries. Hope it works for you.
 
ADO works fine with Access 97 if you reference the correct libraries. :)

Onwards,

Q-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top