Using a button to filter a sub-form - doesn't work when using main form.

AndyC88

Member
Local time
Today, 09:58
Joined
Dec 4, 2020
Messages
44
Afternoon all,

I've got the following issue - I have a list of equipment requirements for each individual - and I want to be able to filter them based on their EquipmentCategoryID.

Using the buttons, it works as expected when the form is opened by itself. However, when I try and use the filters when the subform is open on the main form - it doesn't seem to like it and displays the error shown below.

Any pointers much appreciated! :)

Thanks,

Andy
 

Attachments

  • DB_Project.accdb
    DB_Project.accdb
    1.8 MB · Views: 197
  • Subform_Not_working.JPG
    Subform_Not_working.JPG
    41.7 KB · Views: 188
  • Subform_working.JPG
    Subform_working.JPG
    36.9 KB · Views: 143
I haven't played much with macroes, but it clearly says that you have to supply the control name if not the parent form.?
 
I've read that macros aren't the best method - but I have zero experience writing any kind of code so it's all I can use at present... will take a look now.
 
I've read that macros aren't the best method - but I have zero experience writing any kind of code so it's all I can use at present... will take a look now.
I am trying to work out what control it wants, the control for categoryID, the subformcontrol or what ???

I'd start Googling.

Plenty of videos on YouTube
 
Last edited:
Thanks Gasman, I watched the video but that's using combo boxes to filter a query. My form is just based on tables - not sure I can get it to do the same?

The control it wants should be the EquipmentCategoryID - so that it filters from a list of ~130 down into a more manageable list. It works fine on the form - but doesn't work as a subform.
 
There were plenty of other videos there?

I would stop now TBH and have a rethink. What happens when you have another category? A whole new button and another macro.?
I would start to learn VBA. You have already discovered macroes can be somewhat limited. I still cannot find the syntax for the control and the help does not even mention it. :devilish:

That is your issue in this case. I will keep having a go at the syntax, just for my benefit, but I'd seriously consider using VBA. Even I could help then. :)

Plenty of links on how to filter form/subform, but very few if any on the ground for macros. :(
 

Users who are viewing this thread

Back
Top Bottom