Forms/SubForm
I have a form that inserts data into a subform on the same form. When I click the Save button, that has an insert sql statement. The command inserts data into the subform twice.
Here is the code
Private Sub Command15_Click()
On Error GoTo Err_Command15_Click
txtrevision.SetFocus
strRevision = txtrevision.Text
txtrevision_date.SetFocus
txtDate = txtrevision_date.Text
strSQL = "INSERT INTO tblhistory(revision, QCPid,revision_date) VALUES ('" & strRevision & "' ," & Forms.frmqcplist1.txtQcp & ", '" & txtDate & " ')"
DoCmd.RunSQL strSQL
Form_Load
Exit_Command15_Click:
Exit Sub
Err_Command15_Click:
MsgBox Err.Description
Resume Exit_Command15_Click
End Sub
lucasfatoye
|