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

Trying to create two recordsets in one sub

Status
Not open for further replies.

maha

Programmer
May 18, 2001
10
US
Hi,

I'm trying to create two recordsets in one sub. I'm having no problem with the first recordset, but with the second recordset I keep getting an "Object Required" message on my set rst2 line. This is the code for the second recordset I'm trying to create. My first recordset is created the same way and I'm having no problems with that one.

Dim db2 As Database
Dim rst2 As Recordset

Set db2 = CurrentDb
Set rst2 = db.OpenRecordset("SELECT * FROM Part WHERE [ReplacementParts] = """ & PartEntered & """")


Thanks a lot for any help,
Maha
 
I could be missing something else, but right off the bat I noticed that you forgot to change db.OpenRecordset to db2.OpenRecordset.

Give that a try.
 
Also, Unless there is something different going on, there should be no need to define/instantiate the db twice in a single sub (or function)


MichaelRed
redmsp@erols.com

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top