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

Can't seem to open a recordset in access2000 1

Status
Not open for further replies.

JaneC

Programmer
Jul 18, 2001
125
GB
Hi guys,

I'm driving myself slowly round the twist here. All I want to do is open a recordset so I can loop through and reset some of the fields.

But I get a type mismatch error on the set RS line (last one below)
maybe the set dbs isn't working ? Am I doing something wrong ?


Sub setval()

Dim dbs As Database
Dim RS As Recordset
Dim prevvalue As Variant

Set dbs = CurrentDb
Set RS = dbs.OpenRecordset("patflows1")


This is the start of my code.

Any help gratefully received.

Jane
 
Hi,

I think that this may be that Access is getting confused between ADO and DAO code.
To fix this, go to tools -> references and ensure that there is a tick in the Microsoft DAO 3.6 Object Library then change your code to:

Code:
    Dim dbs As DAO.Database
    Dim RS As DAO.Recordset
    Dim prevvalue As Variant

Thereafter it should work fine.

John
 
Hi John,

Thank you, thank you, thank you. It worked a treat.

Jane
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top