Subject: Forms/SubForm
Posted By: captainlove Post Date: 4/19/2008 11:31:16 AM
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

Go to topic 46119

Return to index page 1