Hello,
This should be fairly simple, but I can't seem to finish off the code for this to work. I've followed other posts to do what I want to do, but I cant seem to get it going.
I have a form with a subform with a button beside. If a user presses the button, a new entry in the table (the source of the subform) will be created with the exact same entries as the selected record. The small code I wrote is an SQL Query that does INSERT on a SELECT. It works, but I cannot seem to restrict to the selected record without getting a "Too few parameters" Error.
Here is the code of the button:
Code:
Private Sub Command5_Click()
CurrentDb.Execute ("INSERT INTO tblTestTable (TestAttribute1, TestAttribute2, TestAttribute3)" & _
"SELECT TestAttribute1, TestAttribute2, TestAttribute3 FROM tblTestTable WHERE (((tblTestTable.TestID)=(Me.tblTestTable_subform_Label![TestID])));")
Me.Refresh
End Sub
Any help would be appreciated, thx. I uploaded a sample database with the code that is not working.