bobjackson
Programmer
I've hit a complete blank on where to start on the following other than the pre-requisites so this is a big ask but any suggestions/help would be gratefully appreciated, even if just a starting point. Due to the complexity I've included a cut down sample version with tables etc.
I have a form Frm_WO_Contents which points to a query Qry_WO_Selection at the bottom of the form I have a combobox combo7 which points to Tbl_Work_orders for it’s list and also a command button Command9 that I wish to click to create new records in another table based on the selection of combo7.
However one of the new fields that I want to create in the new table is based on some statistical calculations. I have another table called Tbl_Insp_Strategy which has a no. of fields “From”, “To”, “V”, “C”, “D” there are currently only 3 records in this table and this is unlikely to change. For example record one is “From” 0, “To” 3, “V” 20, “C” 80, “D” 0
The query Qry_WO_Selection has a field called “Insp Score” for each record in Qry_WO_Selection relating to the WO_ID selected in Combo7 I want to check the records against each of the 3 records in Tbl_Insp_Strategy so for all the records in Qry_WO_Selection with WO_ID (e.g. 1) from record one of Tbl_Insp_Strategy quantify no. of records whose “Insp Score” is between the “From” and “To” values of record one of Tbl_Insp_Strategy (i.e. 0 to 3)
From these filtered records i.e. only records in Qry_WO_Selection with selected WO_ID and Insp Score between 0 and 3 randomly create new records in table Tbl_Inspections including WO_ID, PIN, SHT, and Insp Type. (WO_ID, PIN and SHT are fields in Qry_WO_Selection) Insp Type needs to be generated for all records with Insp Score between 0 and 3 randomly select 20% of records(value from record in Tbl_Insp_Strategy) and write “V” to field “Insp Type”, randomly select 80% of remainder records (value from record in Tbl_Insp_Strategy) and write “C” to field “Inst Type” and then finally select remainder records and write “D” to field “Inst Type”
Repeat the above for the other records of Tbl_Insp_Strategy (i.e. another two records)
Once all complete write “True” to Yes/No field to “Insp_Created” field for relevant record relating to WO_ID in table Tbl_Work_Orders
Regards,
Rob
I have a form Frm_WO_Contents which points to a query Qry_WO_Selection at the bottom of the form I have a combobox combo7 which points to Tbl_Work_orders for it’s list and also a command button Command9 that I wish to click to create new records in another table based on the selection of combo7.
However one of the new fields that I want to create in the new table is based on some statistical calculations. I have another table called Tbl_Insp_Strategy which has a no. of fields “From”, “To”, “V”, “C”, “D” there are currently only 3 records in this table and this is unlikely to change. For example record one is “From” 0, “To” 3, “V” 20, “C” 80, “D” 0
The query Qry_WO_Selection has a field called “Insp Score” for each record in Qry_WO_Selection relating to the WO_ID selected in Combo7 I want to check the records against each of the 3 records in Tbl_Insp_Strategy so for all the records in Qry_WO_Selection with WO_ID (e.g. 1) from record one of Tbl_Insp_Strategy quantify no. of records whose “Insp Score” is between the “From” and “To” values of record one of Tbl_Insp_Strategy (i.e. 0 to 3)
From these filtered records i.e. only records in Qry_WO_Selection with selected WO_ID and Insp Score between 0 and 3 randomly create new records in table Tbl_Inspections including WO_ID, PIN, SHT, and Insp Type. (WO_ID, PIN and SHT are fields in Qry_WO_Selection) Insp Type needs to be generated for all records with Insp Score between 0 and 3 randomly select 20% of records(value from record in Tbl_Insp_Strategy) and write “V” to field “Insp Type”, randomly select 80% of remainder records (value from record in Tbl_Insp_Strategy) and write “C” to field “Inst Type” and then finally select remainder records and write “D” to field “Inst Type”
Repeat the above for the other records of Tbl_Insp_Strategy (i.e. another two records)
Once all complete write “True” to Yes/No field to “Insp_Created” field for relevant record relating to WO_ID in table Tbl_Work_Orders
Regards,
Rob