Subform Filter

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form with a filter on it that works fine: DoCmd.ApplyFilter et
cetera. However, when I put the form as a subform on another form and try to
run the filter I receive the error: The action or method is invalid because
the form or report isn't bound to a table or query.
I'm guessing the filter was run on the new form level, not the subform. What
am I doing wrong?

Thanks.
 
apparently the main form that contain your subform, does not have a
recordsource.
and when you run the command DoCmd.ApplyFilter, this command acts on the
main form
and you cannot have a filter on a form that has no recordset! that's why you
get this error

if you want to enable or disable your filter on demand, use
MyMainForm.MySubForm.Form.FilterOn= True or False
 
if you want to enable or disable your filter on demand, use
MyMainForm.MySubForm.Form.FilterOn= True or False

Do I put this command in the on load event of the main page? The after
update event of the text box I'm using to search?
I tried both and couldn't seem to get it to work. My main form is frmUpdate
and my subform is frmAuction, I tried:
frmUpdate.frmAuction.Form.FilterOn = True

Thanks
 
Hi!

if you want me to help you, please tell me how does your update form look
like? you didn't talk about the search text box in your original message..
where do you display the result? in the main or in the subform ? in sum,
what do u want to do?
 
if you have search textbox in the main form and want to filter the records
displayed into your subform, so
on the AfterUpdate event of the textbox, write:

MyMainForm.MySubForm.Form.Filter = "FieldName=" & SearchTextBox
MyMainForm.MySubForm.Form.FilterOn = True
 

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

Back
Top