Defining a Recordset for a Subform on a Tabbed Control for a Loop

  • Thread starter swm via AccessMonster.com
  • Start date
S

swm via AccessMonster.com

See the commented line...just can't get to this recordset!

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
 
T

Tim Ferguson

Set rs = Me![report_tab]. _
[Invoices_tbl_subform]. _
Form. _
RecordSource

A recordsource is a string value; you need a recordset. Try one of

' open a recordset
Set rs = db.OpenRecordset( Me![report_tab]. _
[Invoices_tbl_subform]. _
Form. _
RecordSource, dbOpenSnapshot, dbForwardOnly)


' or access the form's recordset or recordsetclone property:
Set rs = Me![report_tab]. _
[Invoices_tbl_subform]. _
Form. _
RecordSetClone

Hope that helps


Tim F
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top