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

Passing through a subform with a VBA

Status
Not open for further replies.

rbasniak

Technical User
Dec 4, 2003
3
BR
Hi people,

How do I iterate through all registers in a subform which is in the form using VBA?

Thanks,
Rodrigo Basniak
 
And what is a register ?
Please, read carefully the second FAQ in my sig.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I believe "registers" are "records". If so, you can use DAO code that sets a DAO.Recordset to the subFormName.Form.RecordsetClone. You can then move through the recordset like any other recordset.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Sorry PH :-(, and thanks Duane :-D, that's what I wanted to say.

I tried the following code:

Dim rst As Recordset

Set rst = Me.Products_Subform.Form.RecordsetClone

But I'm getting the Incomptible Types error (13) on the Set line.

What am I doing wrong?

Best regards,
Rodrigo Basniak
 
I solved the problem with this:

Dim frm As Form
Set frm = Me.Products_Subform.Form

frm.RecordsetClone.MoveFirst

....

Thanks at all people,
Rodrigo Basniak
 
The problem was here:
Dim rst As [!]DAO.[/!]Recordset

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top