changing the recordsource of a subform

G

Guest

I have a tab control on a form with four pages and a
subform on each page. I want to change the records
displayed on each subform when the user clicks an edit
button on the main form and inputs a spec number. I gave
up trying to filter the subforms and am now trying to
change the recordsource for each subform. I have spent
days trying to figure this out.

This is my latest of many attempts:

tabProducts.Pages!pgAprons!sfrmApron.Form.RecordSource =
strSource

Where:
strSource is a SQL query string,
tabProducts is the tab control,
pgAprons is one of the pages on tbProducts and
sfrmAprons is the subform control. (frmApron is the name
of the form in the subform control).

I get the error message "Object does not support this
property or method".

Can anyone help me?
 
P

PC Datasheet

All controls on a tabcontrol are on the form that the tabcontrol is on. So to
reference a subform control on any page from the main form, you just need
Me!NameOfSubformControl. The name of the subform displayed by a subform control
is the source object property of the subform control. So to set the subform to
be displayed in a subform control you need:
Me!NameOfSubformControl.SourceObject = "NameOfSubform"
 
G

Gary Miller

You don't need to refer to the Tab or the Pages, just refer
to the name of the subform control that holds the form and
then to the Form property of that control...

Me!sfrmApron.Form.RecordSource = strSource


--

Gary Miller
Gary Miller Computer Services
Sisters, OR
________________________
 

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