First of all, thank you for the many videos that you have posted. They have been very helpful. My question is related to the following video: Video Reference: "How to Filter a Report Based on the Filter Set in a Form in Microsoft Access"
In the'video above, the vba code is based on a single form and'I was successful when duplicating the vba code in my own database. However, I now want to take it one step further and filter a report based on the filter set of a "subform within a parent form." Examples:Parent form: frmCustomerSubform: sfrmCustomerOrders Current vba code:Me.Filter = Forms!sfrmCustomerOrders.Filter
How do I revise the vba code to include the'parent form (frmCustomer)?'I have tried numerous methods and nothing works!
I watched the video you referenced and tried to apply the'syntax,'but unfortunately it did not work to open a report. I am trying to reproduce similar results as shown in the video "How to Filter a Report Based on the Filter Set in a Form in Microsoft Access" except that I want to put my form inside another form. I think that I need to revise the syntax to reference both the parent and subform.'The report button runs a list of customer orders and is currently on the subform.
This syntax does not work for my situation: Forms!ParentFormName!SubFormName.Form!FieldName
This is my current syntax, which only works if my subform is open:
Me.Filter = Forms!sfrmCustomerOrders.Filter
Me.Filter = Forms!sfrmCustomerOrders.FilterOn
I want to put the subform [sfrmCustomerOrders] inside the parent form [frmCustomer] and run a customer orders report based on option button filters. Could you give an example of how to put [frmCustomer] in the following syntax?
Me.Filter = Forms!sfrmCustomerOrders.Filter''
Thank you!
Adam Schwanz
@Reply 2 years ago
So just to clarify, what are you trying to do. I'm getting confused by the wording.
You have a field like "Customer" for instance in your subform, you pick John Smith and want to open a report for only John Smith kind of thing?
Where is the button that is opening the report, is it on the parent form, or the subform? Or a different form entirely?
Sorry, only students may add comments.
Click here for more
information on how you can set up an account.
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
This thread is now CLOSED. If you wish to comment, start a NEW discussion in
Visitor Forum.