Form Filters

B

BobT

I have a main form with a subform. I would like to create to command buttons
on the main form. The first when clicked would set a filter on the subform
based on a field that I have on my main form.

The second button would show all records.

The second command button is working fine. How would I setup the first
command button?
Thanks
 
T

t t via AccessMonster.com

if you want to set same filter on every click then the code for the command
button 1 is ;
Forms!Formmain!Formsub.Form.Filter = " [field1] like '*moon*'"
Forms!Formmain.Formsub.Form.FilterOn = True

or if you want to use a texbox as a criteria field then code is;

Forms!Formmain!Formsub.Form.Filter = " [field1] like '*' & forms!formmain.
[textbox]& '*'"
Forms!Formmain.Formsub.Form.FilterOn = True


Hope this will be usefull
 
Top