Hello all,
I have a form that fills a table called tblInspections. Among many other fields, tblInspections has the following fields: DistrictNumber, SectionNumber, MunicipalityID, and InspectionSiteID. All are foreign keys that refer to their own separate tables where they are primary keys.
They way it works is that a whole area is divided into districts, and each district is divided into sections, and each section can fall in one of the many towns/cities that have been defined by state government. Thus, I have a tblInspectionSites that lists all current sites and their districts, sections, and municipalities. Each site is distinguished by a site number.
For frmInspections, I use option groups to set the district and section numbers. Using these values, I have a combobox linked to a query that finds all municipalities that happen to fall in that combination of District and Section. This query populates the dropdown choice list. Once this is set, the InspectionSiteID also uses a combobox that uses a query that filters all inspection site by the district, section, and municipality selected to populate the dropdown choices. (To refresh the queries, I have each combobox requery on GotFocus.)
Now this all works when I'm inputting a record. However, when I'm browsing through previous records, the comboboxes display as empty even though the table does have values stored for them. I think this is because the most recent query for each combobox sometimes doesn't include the value stored in the table for that specific record (I hope that makes sense.)
Is there a way to only run the query to populate the combobox when creating new records or editing and not when I am just browsing? Or am I justdoing something wrong? Any suggestions would be much appreciated.