I have a subform called PaymentDetails and would like to dynamically assign
the recordsource after the form/subform is opened.
The recordsource for Payment Details is "PaymentDetails_qry" which uses
a function to filter the Invoice #. The invoiceID is not known until after
the
form is opened. After the InvoiceID is selected from a dropdown I then
want to assign the recordsource
Me!Form!PaymentDetails.Recordsource="PaymentDetails_qry"
but this is giving me an error.
Any suggestions?
Wayne Morgan - 08 Nov 2004 16:04 GMT
The path to the subform is
Me.ctlNameOfSubformControl.Form.PropertyOrControl
The Subform Control is a control on the main form that holds the subform. To
get the name of this control (it may or may not be the same as the subform,
depending on how you added the subform to the main form), open the main form
in design mode, open the Properties sheet, and click on the subform ONE
time. The Properties sheet should show the name of the subform control. If
you click more than once, you'll be in the subform and the Properties sheet
will show the name of the subform or its components, not the name of the
control holding the subform.

Signature
Wayne Morgan
MS Access MVP
>I have a subform called PaymentDetails and would like to dynamically assign
> the recordsource after the form/subform is opened.
[quoted text clipped - 11 lines]
>
> Any suggestions?
PC Datasheet - 08 Nov 2004 18:16 GMT
Bill,
"Form" is in the wrong place. Use the Form property to identify that you are
making reference to the form the subform control contains----
Me!PaymentDetails.Form.Recordsource="PaymentDetails_qry"
Check that your subform control os named PaymentDetails.
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
resource@pcdatasheet.com
www.pcdatasheet.com
> I have a subform called PaymentDetails and would like to dynamically assign
> the recordsource after the form/subform is opened.
[quoted text clipped - 10 lines]
>
> Any suggestions?