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

Creating a DB instance

Status
Not open for further replies.

Tronsliver

Technical User
Sep 19, 2000
120
0
0
US
I used the following code in Access 97 to open a RecordSet within a Function for follow-on processing. When I tried the same code in Access 2002 I get an error on line "Set rst". Can someone tell me if this is still a valid way to approach this.

Public Function FindAuthStr(varx As String)
Dim rst As Recordset
Dim x As Double

Set rst = CurrentDb().OpenRecordset("qryAuthAssign", dbOpenDynaset)

With rst......
 
Hi!

In a97, the default recordset library was ADO, in 2000 and xp, it is ADO, having slightly different syntax/methods. There's no problem, though, to use DAO in newer versions, just

1 - ensure there's a reference to Microsoft DAO 3.# Object Library (in VBE - Tools | References
2 - recommend explicit declaration of all databae/recordset variables:

[tt]dim rs as dao.recordset
dim db as dao.database
set db=currentdb
set rs=db.openrecordset(...[/tt]

For more Access related questions, check out the Access fora (find them in the "Related Forums" box at the right)

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top