Hi,
I am trying to get the following code to close the form without saveing if the message box answer is "No" but I don't want it to save if "text1" is null. At the moment the form wont close if "text1" is null. So if the form is opened just to view it wont close.
Private Sub Command6_Click()
On Error GoTo Err_Command6_Click
Dim intReturn As Integer
intReturn = MsgBox("Would you like to save this record?", vbYesNo + vbDefaultButton3, "Save changes?")
Select Case intReturn
Case vbYes
'Do Nothing
Case vbNo
Me.Undo
End Select
If IsNull(Me!text1) Then
Beep
MsgBox "Additional pay number cannot be null", vbExclamation, "Required selection"
Else
DoCmd.Close
End If
Exit_Command6_Click:
Exit Sub
Err_Command6_Click:
MsgBox Err.Description
Resume Exit_Command6_Click
End Sub
I am trying to get the following code to close the form without saveing if the message box answer is "No" but I don't want it to save if "text1" is null. At the moment the form wont close if "text1" is null. So if the form is opened just to view it wont close.
Private Sub Command6_Click()
On Error GoTo Err_Command6_Click
Dim intReturn As Integer
intReturn = MsgBox("Would you like to save this record?", vbYesNo + vbDefaultButton3, "Save changes?")
Select Case intReturn
Case vbYes
'Do Nothing
Case vbNo
Me.Undo
End Select
If IsNull(Me!text1) Then
Beep
MsgBox "Additional pay number cannot be null", vbExclamation, "Required selection"
Else
DoCmd.Close
End If
Exit_Command6_Click:
Exit Sub
Err_Command6_Click:
MsgBox Err.Description
Resume Exit_Command6_Click
End Sub