Solved Subform filtered by Main Form (1 Viewer)

Dipo

New member
Local time
Today, 01:33
Joined
Jul 8, 2021
Messages
24
Hello,

I will appreciated if someone can help me to fix a problem.

I want to create a form where the list on subform is filtered by the selection on the main form.

Eg I have tables Category, Description where if in Category =Food the only option on Description will be types of food.

Thanks in anticipation.
 

Minty

AWF VIP
Local time
Today, 01:33
Joined
Jul 26, 2013
Messages
10,371
You can set the master/child properties of the subform data to more than one field, separated by a semicolon.

That might achieve exactly what you want without any code involved?
 

Dipo

New member
Local time
Today, 01:33
Joined
Jul 8, 2021
Messages
24
You can set the master/child properties of the subform data to more than one field, separated by a semicolon.

That might achieve exactly what you want without any code involved?
Thanks. Will explore and revert if it helps. I actually prefer non coding solution as I am not fluent with VBA
 

Dipo

New member
Local time
Today, 01:33
Joined
Jul 8, 2021
Messages
24
Hi, thanks for the suggestion but unfortunately I couldn't resolve it.

Attached is the db. The form in question is the DATA ENTRY.

What I want to achieve is that during data entry, once a category is selected the choices of description (details) should be filtered based on the category.

Thanks.
You can set the master/child properties of the subform data to more than one field, separated by a semicolon.

That might achieve exactly what you want without any code involved?
 

Attachments

  • PBS_prices.accdb
    1 MB · Views: 387

bob fitz

AWF VIP
Local time
Today, 01:33
Joined
May 23, 2011
Messages
4,727
If I've understood your requirement correctly then perhaps something like this:
I have changed the Lookup field in the table "Item Description". See: http://access.mvps.org/access/lookupfields.htm
IMHO it would be better NOT to have spaces in the names given to any of the objects in Access.
 

Attachments

  • PBS_prices Bob01.accdb
    560 KB · Views: 190

Dipo

New member
Local time
Today, 01:33
Joined
Jul 8, 2021
Messages
24
If I've understood your requirement correctly then perhaps something like this:
I have changed the Lookup field in the table "Item Description". See: http://access.mvps.org/access/lookupfields.htm
IMHO it would be better NOT to have spaces in the names given to any of the objects in Access.
Thanks for the effort it seems to be working though with a minor glitch I should be able to fix, can you please help highlight what you did differently from what I did because the relationship seems retained.

Gracias
 

bob fitz

AWF VIP
Local time
Today, 01:33
Joined
May 23, 2011
Messages
4,727
AFAICR I added the Category field to the SQL statement used in the combo box on the subform and added criteria on that field.
I also added a line of code to the Got focus event so that it would requery.
 

Dipo

New member
Local time
Today, 01:33
Joined
Jul 8, 2021
Messages
24
AFAICR I added the Category field to the SQL statement used in the combo box on the subform and added criteria on that field.
I also added a line of code to the Got focus event so that it would requery.
Thanks a lot. I figured out the sql filter in the source but didn't notice the on focus. I really appreciate.
 

Users who are viewing this thread

Top Bottom