Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 1 / November 2004

Tip: Looking for answers? Try searching our database.

Dynamically assign Recordsource to subform

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bill Agee - 08 Nov 2004 15:46 GMT
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?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.