View Full Version : Access recordSource from Form's VB Code


eellenoff
12-21-2008, 01:28 PM
Hello,

I have a form with the recordSource set to a query that would give me a set of contact information. What I would like to be able to do is to iterate through that query, and access the attributes of each tupple. Do I somehow have access to the data contained in the query by nature of it being the recordSource? If so, what is the syntax for accessing that data? If not, can anyone provide some skeleton code as to how I should connect back to the database to get the query data I need?

Thanks!
-Eric

Access 2003, VB6

Steve R.
12-21-2008, 02:07 PM
Design a form where the record source is the query. You can then add two command buttons to move through the record source (next and previous).

gemma-the-husky
12-21-2008, 02:18 PM
or use a recordset

set rst=currentdb.openrecordset(myquery)
while not rst.eof
'read fields in this tuple with
rst!fieldname syntax

'goto nerxt record with
rst.movenext
wend

Banana
12-21-2008, 02:50 PM
and as FYI- in Access 2000 and later, you can manage form's recordset instead of recordsource and do something with it, if so desired.