Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ac97 subform on Tab control reference 1

Status
Not open for further replies.

sdraper

Programmer
May 6, 2002
332
US
In Access 97 I have an unbound form with a Tab control and on each tab page I have a subform bound to a table. I want to pass the contents of a textbox on the main unbound form as the filter criteria for the subform on the Tab control. I am having difficulty drilling down to the subform. Can anyone offer any links or suggestions??
Thanks,


Sam
 
I think if you treat your subforms as any other subform, you should be able to set the Filter property, regardless of the fact they are on a Tab control or not. So maybe on the AfterUpdate event of the textbox on the main form:

Dim Flt as String
'Modify to built a valid filter for your table.
Flt = "tblField='" & textboxvalue & "'"
Me!SubForm1.Form.Filter = Flt
Me!SubForm1.Form.FilterOn = True
Me!SubForm2.Form.Filter = Flt
Me!SubForm2.Form.FilterOn = True

If you want to speed your form up, don't set the subform filter until that tab is activated.

Ken
 
I am at home so I can't try it yet but I will. Thanks for the input.
I have been using:
Me!SubForm1.Filter = Flt
Me!SubForm1.FilterOn = True
instead of what you suggest:
Me!SubForm1.Form.Filter = Flt
Me!SubForm1.Form.FilterOn = True
Is that because the subform object is just a container and "Form" is the actual form object in the container?

Sam
 
Yes, the subform is both a control, and a form. To reference the form properties of a subform, you need to append the .form to the subform control name. In fact, you should have gotten an error without it, since the Filter property is not a control property.

Ken
 
I did get an error when I did that.
"Object does not support this method"
It all makes sense now. Thanks again

Sam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top