M
MarkK
I am trying to build a form that allows the user to add a record for a new
product, and specify its category (based upon a table of predefined
categories) and then a subcategory (again, based upon a table that has three
rows: ID, Subcategory, CategoryID). Each category has multiple predefined
subcategories. I am having difficulty limiting the subcategory list for for
the subcategory combobox to only show those subcategories assoicated with the
category the user just entered in the form.
For the Category combo box on the form, I have the following macro for After
Update:
RemoveAllTempVars (there are no other uses of temp vars in my database)
SetTempVar CatValue,Forms![ProductForm]![CategoryID] (i.e., ID value for
category user just inputted)
(If I also place an OpenQuery action next, I see the query table shows only
those subcategories as expected)
For the Subcategory combobox on the form, its list is based upon a query
that uses the criteria of [TempVars]![CatValue] for the CategoryID value. The
intention is to use CatValue to filter the subcategory values.
For the Subcategory combobox, I have a macro assigned to OnMouseDown that is:
Requery (no arguments)
I expected this requery to rerun the query, retuirning only the
subcategories desired. But instead, the form goes to record #1, no other
errors.
Greatly appreciate any help with how to setup the proper macros for this. I
have not been able to find an answer to this in Access 2007 InsideOut.
product, and specify its category (based upon a table of predefined
categories) and then a subcategory (again, based upon a table that has three
rows: ID, Subcategory, CategoryID). Each category has multiple predefined
subcategories. I am having difficulty limiting the subcategory list for for
the subcategory combobox to only show those subcategories assoicated with the
category the user just entered in the form.
For the Category combo box on the form, I have the following macro for After
Update:
RemoveAllTempVars (there are no other uses of temp vars in my database)
SetTempVar CatValue,Forms![ProductForm]![CategoryID] (i.e., ID value for
category user just inputted)
(If I also place an OpenQuery action next, I see the query table shows only
those subcategories as expected)
For the Subcategory combobox on the form, its list is based upon a query
that uses the criteria of [TempVars]![CatValue] for the CategoryID value. The
intention is to use CatValue to filter the subcategory values.
For the Subcategory combobox, I have a macro assigned to OnMouseDown that is:
Requery (no arguments)
I expected this requery to rerun the query, retuirning only the
subcategories desired. But instead, the form goes to record #1, no other
errors.
Greatly appreciate any help with how to setup the proper macros for this. I
have not been able to find an answer to this in Access 2007 InsideOut.