Access to Linked Recordsets

raktims

Registered User.
Local time
Today, 09:25
Joined
Jul 29, 2003
Messages
19
Hi,

I have a Form with a subform in it linked on a field. I can access the the records for the main form with the 'Me' object. How can I access the recordset of the subform in the VB code space.

I am not too familiar with linked recordsets. Any suggestions will be helpful.

Thanks,
Raktim
 
When generating VBA behind the subform, use Me too. Me always references to the instant form.

When you're on the main form and referring to subform fields, use me!subformname!fieldname. You can also use forms!mainformname!subformname!fieldname.

When you're on the subform and referring to main form fields, use Forms!MainFormName!fieldname.

Accessing properties is a little different, but that's not the question.
 
That is good. Thnaks. But is there no way to refer to the subform recordset from the main form VB space ?

Raktim
 
You can refer to any recordset anywhere. Generally you want a specific record.

If you want a specific record on a subform, change the filter or criteria of the subform and requery.

If you merely want some record other than what's being displayed, you use DAO or ADO to get that record.

Refering a a subform's recodrset doesn't tell me anything specific, but I have alzheimer's and can't always remeber what I know.
 
This is how I figured to access the subform recordset from Main form recordset:

Me.[SubForm_Name].Form.Recordset

Hope this jogs up your alzheimer's memory.

Thanks for your help.
 

Users who are viewing this thread

Back
Top Bottom