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

How to set ADODB.Connection in Access97? 1

Status
Not open for further replies.

surotkin

Programmer
Dec 10, 2003
103
CA
Hi everybody,
I am converting Access2003 application into Access97.
The entire database seems fine after conversion except for one portion of the code.

The code is as follows:

Code:
Dim rs As New ADODB.RecordSet
rs.Open "SELECT * FROM tblSomething", CurrentProject.Connection, <some other params>

Access97 can't seem to find the CurrentProject reference. Is there a way to go about this?

I found the similar thread thread705-288838 but they suggest to move to DAO.

Any ideas?
Any help is appreciated.
Thank you in advance.
surotkin
 
So this means you don't like their answer and want Microsoft to rewrite Access 97?
DAO, which is used in 97, was designed for Access or Jet databases and connections were not necessary. ADO is a generic interface so you must specify the Provider name and make a communication line into the database.
Whoever is using 97 and doesn't want to upgrade, doesn't understand the incompatibility issues involved.
 
A'97 natively supports DAO ... not ADO. You can however use ADO by setting a reference to Microsoft ActiveX Data Objects 2.x Library and then
Code:
Dim rs As New ADODB.RecordSet
Dim cn As New ADODB.Connection
cn.Open <Some Connection String>
rs.Open "SELECT * FROM tblSomething", [COLOR=red]cn[/color], <some other params>
But as fneily implies, why not just use DAO?

[small]No! No! You're not thinking ... you're only being logical.
- Neils Bohr[/small]
 
Well I guess if he has lots of lines of ADO code it would be easier to stick with ADO than to try to switch to DAO. All he really needs to do is set a reference to ADO, create and open a connection object to his (presumably) backend tables, then search & replace all occurences of CurrentProject.Connection with his connection object.
 
Hi everyone,
Thanks for responces.

JoeAtWork, you are absolutely right. It is mush more easier for me to replace all occurences of CurrentProject.Connection than to change everything to DAO.

Thanks.
surotkin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top