I am trying to create a form that will add a record to the bound table and also to the related tables. I also would like to prevent the form from updating until the user clicks the add button. This will trigger the record save and then (ideally) the creation of a record in 3 other tables.
I have seen a thread on usinge the beforeupdate event, but I could not get that to function.
I have the following for my command buttons now:
I am assuming to add records to the other tables I could use the following after the save record command:
Thanks for the help!
I have seen a thread on usinge the beforeupdate event, but I could not get that to function.
I have the following for my command buttons now:
Code:
Private Sub Cancel_Click()
On Error GoTo Err_Cancel_Click
If Me.Dirty Then
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
End If
DoCmd.Close
Exit_Cancel_Click:
Exit Sub
Err_Cancel_Click:
MsgBox Err.Description
Resume Exit_Cancel_Click
End Sub
Private Sub AddMR_Click()
On Error GoTo Err_AddMR_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Exit_AddMR_Click:
Exit Sub
Err_AddMR_Click:
MsgBox Err.Description
Resume Exit_AddMR_Click
End Sub
I am assuming to add records to the other tables I could use the following after the save record command:
Code:
DoCmd.RunSQL "Insert INTO QUOTE(MRID) VALUES(" & Me.MRID & ")"
DoCmd.RunSQL "Insert INTO PO(MRID) VALUES(" & Me.MRID & ")"
DoCmd.RunSQL "Insert INTO PREQ(MRID) VALUES(" & Me.MRID & ")"
Thanks for the help!