Filter Continuous Form with 2 combobox (1 Viewer)

Jonny45wakey

Member
Local time
Today, 09:06
Joined
May 4, 2020
Messages
40
Happy New Year to All :)

I've been searching for a solution to enable me to filter a continuous form using 2 comboboxes but without success!

On the form are the following:-

Combobox 1 = "CboYEAR" - rowsource has value list of Years from 2022 onwards
Combobox 2 = "CboCELL - rowsource has value list of production cells eg "Welding"

In the datasheet on the form there are the following fields:-

Field 1 = textbox "YEAR"
Field 2 = textbox "CELL"

What i would like to achieve is the user selects the YEAR in 1st Combobox then selects the CELL in the 2nd Combobox and then the form filters accordingly based on these 2 criteria.

Any ideas much appreciated.

Thanks

Jonny
 

Gasman

Enthusiastic Amateur
Local time
Today, 09:06
Joined
Sep 21, 2011
Messages
14,301
This is just setting a form filter in the afterupdate of each control, I would have thought?
Combos would need to be on a mainform, unbound, with your continuous form as a subform.

That is how I would approach it.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 16:06
Joined
May 7, 2009
Messages
19,243
see this demo and the Code behind the AfterUpdate event of each combobox.
 

Attachments

  • dbYearCell.accdb
    504 KB · Views: 98

Jonny45wakey

Member
Local time
Today, 09:06
Joined
May 4, 2020
Messages
40
Thanks Gasman & arnelgp

I tried both ideas thanks, unfortunately the attachment from arnelgp didnt work.

I have managed to filter the subform from the mainform by "CboYEAR" but then i cant get the second combobox "cboCELL" to filter the data on the subform by Cell within the selected year (if that makes sense)

My Code on the "cboYEAR" is as follows

1672925587707.png
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 16:06
Joined
May 7, 2009
Messages
19,243
unfortunately the attachment from arnelgp didnt work.
because the sample has No Subform.
did the "demo" did not work also, cause i test it before uploading.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 16:06
Joined
May 7, 2009
Messages
19,243
here try this with subform.
 

Attachments

  • dbYearCell.accdb
    608 KB · Views: 102

Gasman

Enthusiastic Amateur
Local time
Today, 09:06
Joined
Sep 21, 2011
Messages
14,301
Thanks Gasman & arnelgp

I tried both ideas thanks, unfortunately the attachment from arnelgp didnt work.

I have managed to filter the subform from the mainform by "CboYEAR" but then i cant get the second combobox "cboCELL" to filter the data on the subform by Cell within the selected year (if that makes sense)

My Code on the "cboYEAR" is as follows

View attachment 105573
Arnel's code works, I tried it myself.
 

Jonny45wakey

Member
Local time
Today, 09:06
Joined
May 4, 2020
Messages
40
Thanks for the continued support from arnelgp & Gasman

This is the error i get when using the Year and Activity Filters

1672928218786.png
 

Gasman

Enthusiastic Amateur
Local time
Today, 09:06
Joined
Sep 21, 2011
Messages
14,301
As that is not arnel's form, have you copied the code in his demo form to yours? :(
It is called FilterMe ?

=FilterMe()
 

Users who are viewing this thread

Top Bottom