Hi,
I have a main form and related subform, I have before_update code on the main form to check the required fields are entered.
Access saves the main form record if I set focus on the subform, and saves the subform records when set focus on the main form
when I enter the main form records and setfocus of the subform the main form records saved.
THEN if i returned to the main record and removed data from required control and clicked save before update fire and it gives me error 2105 because of this line [DoCmd.GoToRecord , , acNewRec]
the code on save button
End Sub
I have a main form and related subform, I have before_update code on the main form to check the required fields are entered.
Access saves the main form record if I set focus on the subform, and saves the subform records when set focus on the main form
when I enter the main form records and setfocus of the subform the main form records saved.
THEN if i returned to the main record and removed data from required control and clicked save before update fire and it gives me error 2105 because of this line [DoCmd.GoToRecord , , acNewRec]
the code on save button
Code:
Private Sub Save_Click()
Dim icount As Integer
If Not IsNull(Me.InspID) Then
icount = DCount("*", "tbl_InpectionDetail", "inspid = " & Me.InspID & "")
If icount < 1 Then
MsgBox "No detail entry found. Report not saved", vbExclamation, "Hi-Tech SysAdmin"
ElseIf Me.Text32 <> Me.Text34 Then
MsgBox "insert all tests to save the report", vbCritical, "Hi-Tech SysAdmin"
Cancel = True
ElseIf Me.NewRecord = False Then
DoCmd.GoToRecord , , acNewRec
Else
Me.Undo
End If
End If