By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,631 Members | 826 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,631 IT Pros & Developers. It's quick & easy.

Dynamically assign Recordsource to subform

P: n/a
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="PaymentDetail s_qry"

but this is giving me an error.

Any suggestions?
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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.

--
Wayne Morgan
MS Access MVP
"Bill Agee" <ws**@mindspring.com> wrote in message
news:cx*****************@newsread3.news.atl.earthl ink.net...
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="PaymentDetail s_qry"

but this is giving me an error.

Any suggestions?

Nov 13 '05 #2

P: n/a
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="PaymentDetail s_qry"

Check that your subform control os named PaymentDetails.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com

"Bill Agee" <ws**@mindspring.com> wrote in message
news:cx*****************@newsread3.news.atl.earthl ink.net...
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="PaymentDetail s_qry"

but this is giving me an error.

Any suggestions?

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.