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!

Recordset question

Status
Not open for further replies.

sabavno

Programmer
Jul 25, 2002
381
CA
Hi,

Is there such thing in VBA as cursor
I mean could I say select records into the recordset and then treat recordset as it were a table

Example:

sql= Select * from Table1 where Name="sabavno"
Set rst1 = CurrentDb.OpenRecordset(sql,dbOpenDynaset)

I will get a recordset, that supposenly has 2 records in it.

Then I need to write another sql statement to extract out of this recordset just one record that has Initials=PO

How would I do that? I don't want to use the temporary tables and thought to get away with the recordset.

Can I query agains the recordset and what is the syntax for that?

Thanks.
 
After you open the recordset, then you loop through the records until you find something that matches your criteria, something like this:

rst1.MoveFirst
Do until rst1.EOF
If rst1!Initials = "PO" then

'add code here to do what you want with record

End if
rst.MoveNext
Loop

 
You can also filter a recordset i.e., rs.Filter

Cheers,
Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top