I have datasheet form with a list of records whose record source is an sql statement.
I am trying to take all those records on the subform and insert them into another table.
I am using the code below to do this. However, I need to know how I make it do every record on the datasheet form.
Any ideas?
I am trying to take all those records on the subform and insert them into another table.
I am using the code below to do this. However, I need to know how I make it do every record on the datasheet form.
Any ideas?
Code:
DoCmd.GoToRecord , , acFirst
DoCmd.RunSQL ("INSERT INTO tblCampaignHistory ([CampaignID],[OrganisationID]) VALUES (CampaignID.value, Forms!frmCampaigns!frmCampaignRecipients.form!SchoolID)")
DoCmd.SetWarnings (False)
DoCmd.GoToRecord , , acNext
DoCmd.RunSQL ("INSERT INTO tblCampaignHistory ([CampaignID],[OrganisationID]) VALUES (CampaignID.value, Forms!frmCampaigns!frmCampaignRecipients.form!SchoolID)")
DoCmd.SetWarnings (False)