G
Guest
How can I add to the current code (below) a test to make sure that if
Location 1 field is not 0 or is not null and Location 1 RorM field is null
that a msgbox appears stating that "Location 1 RorM must be completed."? I've
tried the following, but it doesn't work. Any ideas how I can add it to the
BeforeUpdate code that is already being used? Thanks.
I've tried:
If me.Location_1 = 0 or IsNotNull(me.Location_1) And Location 1_RorM = ""
then msgbox ("You must pick R or M")
Exit Sub
End If
Current Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Nz(Me!Welded_By_Robot, 0) = 0 Then
Cancel = True 'Don't let the record be saved
Dim strMsg As String 'To assign the message's text
strMsg = "You must choose Yes or No"
If MsgBox(strMsg, vbOKCancel + vbExclamation, _
"Incomplete Data") = vbCancel Then 'If user response is
"Cancel"
Me.Undo
End If
End If
End Sub
Location 1 field is not 0 or is not null and Location 1 RorM field is null
that a msgbox appears stating that "Location 1 RorM must be completed."? I've
tried the following, but it doesn't work. Any ideas how I can add it to the
BeforeUpdate code that is already being used? Thanks.
I've tried:
If me.Location_1 = 0 or IsNotNull(me.Location_1) And Location 1_RorM = ""
then msgbox ("You must pick R or M")
Exit Sub
End If
Current Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Nz(Me!Welded_By_Robot, 0) = 0 Then
Cancel = True 'Don't let the record be saved
Dim strMsg As String 'To assign the message's text
strMsg = "You must choose Yes or No"
If MsgBox(strMsg, vbOKCancel + vbExclamation, _
"Incomplete Data") = vbCancel Then 'If user response is
"Cancel"
Me.Undo
End If
End If
End Sub