Morning all,
I was wondering if someone could help with this code. I have a form and a subform. I want to pass the value of both form and subform to my Master2 table, however I get an error. Revsion No is an automuber field. The section in blue seeems to be the issue. Any help would be greatly appreciated.
Private Sub cmdSaveRevision_Click()
Dim strSql As String
Me.[Revision No] = DMax("[Revision No]", "tblMaster2") + 1
Me.Revision_Date = Now()
On Error GoTo Err_Handler
If Me.Dirty Then Me.Dirty = False
Err_Handler:
If Err.Number = 2101 Then
Exit Sub
End If
strSql = "INSERT INTO tblMaster2 SELECT * FROM tblTempMaster"
CurrentDb.Execute strSql, dbFailOnError
DoCmd.Close acForm, Me.Name
Forms!frmBOMSelectItem.sfrmBOMNo.Form.Requery
End Sub
I was wondering if someone could help with this code. I have a form and a subform. I want to pass the value of both form and subform to my Master2 table, however I get an error. Revsion No is an automuber field. The section in blue seeems to be the issue. Any help would be greatly appreciated.
Private Sub cmdSaveRevision_Click()
Dim strSql As String
Me.[Revision No] = DMax("[Revision No]", "tblMaster2") + 1
Me.Revision_Date = Now()
On Error GoTo Err_Handler
If Me.Dirty Then Me.Dirty = False
Err_Handler:
If Err.Number = 2101 Then
Exit Sub
End If
strSql = "INSERT INTO tblMaster2 SELECT * FROM tblTempMaster"
CurrentDb.Execute strSql, dbFailOnError
DoCmd.Close acForm, Me.Name
Forms!frmBOMSelectItem.sfrmBOMNo.Form.Requery
End Sub