I am developing a database with 2 main tables (tblSiteInfo and tblSiteReviewCriteria) with a one-to-many relationship.
The database contains information on site where audit are being carried out..
The table tblSiteInfo stores generate project info such as names and address.
The table tblSiteReviewCriteria contains commments referring to a fixed set of criteria names (which are also grouped into categories)
Site information is added by typing on a form (frmSiteInfoDataEntry) containing a tab control with a number of pages.
One of the pages contained a subform where the Review Criteria infomation is typed.
I have written a the following query, activated by clicking a button on the form.
INSERT INTO tblSiteReviewCriteria ( SiteID, CriteriaGroup, GroupOrder, CriteriaName, NameOrder )
SELECT tblSiteInfo.SiteID, qryCriteriaGroupsAndNames.CriteriaGroup, qryCriteriaGroupsAndNames.tblCriteriaGroups.SortOrder, qryCriteriaGroupsAndNames.CriteriaName, qryCriteriaGroupsAndNames.tblCriteriaNames.SortOrder
FROM qryCriteriaGroupsAndNames, tblSiteInfo
WHERE (((tblSiteInfo.SiteID)=[Forms]![frmSiteInfoDataEntry]![SiteID]))
ORDER BY qryCriteriaGroupsAndNames.tblCriteriaGroups.SortOrder, qryCriteriaGroupsAndNames.tblCriteriaNames.SortOrder;
(The query qryCriteriaGroupsAndNames just selects information from two other tables. Ultimately I’m looking to develop the database futher,
maybe letting the user choose a subset of values to be appended from a much bigger list)
This appends 36 rows to the Review Criteria table (i.e 36 criteria are bening assessed for each site)
Other fields in this table are then updated manually by typing directly onto the subform within the main data entry form.
*********
Problem, whilst the query works fine, I don’t see the records on the subform unless I move away from the site record and back again.
Why is this, am i doing something wrong?
*********
Secondly, the query needs to be run (and run only once) automatically when a new site record is created.
I’m guessing this will require a test for a new record and maybe be triggered by an after update event.
*********
I’m really a beginner and getting way out of my depth. I think what I’m trying to do in principle is fine but I haven’t got a clue how to do it.
Any help or pointers greatly appreciated.
Darsha