browninaz
Ugly Data Hoarder
- Local time
- Today, 10:30
- Joined
- Oct 26, 2012
- Messages
- 88
Hello Everyone,
Just wanted to know if there is a better way to write this procedure:
Private Sub cmdCancel_Click()
'This line does not allow the user to close form if any field is populated
If Not IsNull(Me.ClientFirst) Or Not IsNull(Me.ClientLast) Or Not IsNull(Me.ClientMainPhone) _
Or Not IsNull(Me.ClientOtherPhone) Or Not IsNull(Me.ClientEmailAddress) Then
MsgBox "Please Delete and Close", , "Unable to Cancel"
Cancel = True
'This line allows the user to close the form if no field has been populated
ElseIf IsNull(Me.ClientFirst) Or IsNull(Me.ClientLast) Or IsNull(Me.ClientMainPhone) _
Or IsNull(Me.ClientOtherPhone) Or IsNull(Me.ClientMainPhone) Or IsNull(Me.ClientEmailAddress) Then
DoCmd.Close
End If
End Sub
Just wanted to know if there is a better way to write this procedure:
Private Sub cmdCancel_Click()
'This line does not allow the user to close form if any field is populated
If Not IsNull(Me.ClientFirst) Or Not IsNull(Me.ClientLast) Or Not IsNull(Me.ClientMainPhone) _
Or Not IsNull(Me.ClientOtherPhone) Or Not IsNull(Me.ClientEmailAddress) Then
MsgBox "Please Delete and Close", , "Unable to Cancel"
Cancel = True
'This line allows the user to close the form if no field has been populated
ElseIf IsNull(Me.ClientFirst) Or IsNull(Me.ClientLast) Or IsNull(Me.ClientMainPhone) _
Or IsNull(Me.ClientOtherPhone) Or IsNull(Me.ClientMainPhone) Or IsNull(Me.ClientEmailAddress) Then
DoCmd.Close
End If
End Sub