recordset question

polina

Registered User.
Local time
Today, 16:57
Joined
Aug 21, 2002
Messages
100
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.
 
polina,

I generally do it with a SQL statement.

You can specify filters and use .find and so on, but I prefer
the following:

sql = "Select * " & _
"From Table1 " & _
"Where Name = 'sabavno' And Initials = 'PO'"

Set rst1 = CurrentDb.OpenRecordset(sql,dbOpenDynaset)

or

sql = "Select * " & _
"From Table1 " & _
"Where Name = '" & Me.txtBox1 & " And " & _
"Initials = '" & Me.txtBox2 & "';"

Set rst1 = CurrentDb.OpenRecordset(sql,dbOpenDynaset)

hth,
Wayne
 
well yes
but after I get my recordset using sql.....how I can query against the new recordset?
 
You can use the Filter property of the RecordSet. There is an example in Access Help under Filter Property.

HTH
 

Users who are viewing this thread

Back
Top Bottom