Hello,
I have a module which works great, but now I need change a bit of the functioning and I have no idea how to proceed.
Using AddNew, it adds records to a table (tbl_Prod_Log_Assoc) based on the number of records in another table (Table 2) using the ID field. The Table 2 has only 7 records with IDs 1 - 7, the AddNew function creates 7 new records in Table 1.
Code:
Function CreatePyroLog()
DoCmd.RunCommand acCmdSaveRecord
Dim DBSPyro As DAO.Database
Dim RDSProdAssoc As DAO.Recordset
Dim VAR_ShowLog As Integer
Dim VAR_Product_Total As Integer
Dim VAR_ProductID As Integer
Set DBSPyro = CurrentDb
Set RDSProdAssoc = DBSPyro.OpenRecordset("tbl_Prod_Log_Assoc")
VAR_ShowLog = Forms!frm_Show_Log.Show_Log_ID
VAR_Product_Total = DCount("*", "Product")
VAR_ProductID = 1
Do Until (VAR_ProductID = (VAR_Product_Total + 1))
RDSProdAssoc.AddNew
RDSProdAssoc!FK_Product_ID = VAR_ProductID
RDSProdAssoc!FK_Show_Log = VAR_ShowLog
RDSProdAssoc.Update
VAR_ProductID = VAR_ProductID + 1
Loop Forms!frm_Show_Log.Refresh
End Function
But now I need to create an Active Yes/No field in Table 1, and then run AddNew based on the criteria that the record is Active. Does this make sense?
Thank you for any help and nudge in the right direciton.