Full Version: Defining a Recordset for a Subform on a Tabbed Control for a Loo
UtterAccess Discussion Forums > Microsoft® Access > Access Modules
lehnen
Dim db As DAO.Database
Dim rs As DAO.Recordset

'Set rs = Me![report_tab].[Invoices_tbl_subform].Form.RecordSource ' Ive tried thhis line w/o the [report_tab] does not work...same for line below...
Set rs = db.OpenRecordset(Me![report_tab].[Invoices_tbl_subform].RecordSource, dbOpenDynaset)
With rs
Do Until .EOF

Me![Invoices_tbl_subform].Form.fTriggerInvoiceBtn ' this a public function that calls a button on the subform
.MoveNext
Loop
End With
JeffK
The form's Recordsource is a string, not a reference to its Recordset. If you want to get the form's Recordset, use its Recordset property. Also, you don't have to to refer to controls on tabs any differently than other controls. They are still properties of the form itself:

This line:
Set rs = Me![report_tab].[Invoices_tbl_subform].Form.RecordSource

Shoud be:
Set rs = Me![Invoices_tbl_subform].Form.RecordSet

OR

This line:
Set rs = db.OpenRecordset(Me![report_tab].[Invoices_tbl_subform].RecordSource, dbOpenDynaset)

Should be:
Set rs = db.OpenRecordset(Me![Invoices_tbl_subform].Form.RecordSource, dbOpenDynaset)
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.