Sorry for the simple question, but I just can't get a handle on this situation. It seems easy but it is turning out to be quite difficult! For me, anyway.
I am using Access 2010. I am writing a database to keep track of my work expenses. I have a table Category, containing entries like A, B, C, D, E. Then I have a Subcategory table with Category/Subcategory like A/A1, A/A2, A/A3, B/B1, B/B2, B/B3 etc. There is a one-to-many relationship based on Category.
I have a subform sbfSubCategory that lists only the subcategory field. I have tried adding and removing the additional Category field as well, but it doesn't change anything. This subform is built from a query rather than a table, so i can sort the fields properly after they are edited.
This subform resides in a form Edit Subcategory.
The Category field is a ComboBox (Combo3) on this Main form.
On the subreport, i have the Link Master Fields and Link Child Fields both equal to Category.
All i want is for the subreport to refresh when i change the value in the Category Combobox.
I have tried entering code to the OnChange event of the combobox to Filter the subreport, but this changes ONLY the Category column and does not show the Subcategory field! I got this from another forum.
If Combo3.ListIndex > -1 and Combo3.value & "" <> "" Then
Me![sbfSubcategory].Form.Filter = "[Category] = '" & Combo3.value & "'"
Me![sbfSubcategory].Form.FilterOn = True
End If
I have tried using the query as the subreport instead of the subform, but that didn't work either.
Access tells me:
"The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship. Change the data in the field or fields that contain duplicate data, remove the index, or redefine the index to permit dupliate entries and try again."
I'm not trying to duplicate any data! I just want to refresh the query that's in the subreport!
I am lost! It shouldn't be this difficult!
I have uploaded my database with only these 2 tables in it.
Any advice?
Thanks....
Susan