How would I put these two BeforeUpdates together (1 Viewer)

hardhitter06

Registered User.
Local time
Today, 09:00
Joined
Dec 21, 2006
Messages
600
Hello,

How would I put these two BeforeUpdates together?

Code:
Private Sub LastMissingDate_BeforeUpdate(Cancel As Integer)
If LastMissingDate.Value > Date Then
MsgBox ("Last Missing Date cannot be greater than Today's Date!")
Cancel = True
End If
End Sub

Code:
Private Sub LastMissingDate_BeforeUpdate(Cancel As Integer)
If LastMissingDate.Value < FirstMissingDate.Value Then
MsgBox ("Last Missing Date cannot be less than First Missing Date!")
Cancel = True
End If
End Sub

Thank you,
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 06:00
Joined
Aug 30, 2003
Messages
36,133
How about:

Private Sub LastMissingDate_BeforeUpdate(Cancel As Integer)
If LastMissingDate.Value > Date Then
MsgBox ("Last Missing Date cannot be greater than Today's Date!")
Cancel = True
Exit Sub
End If

If LastMissingDate.Value < FirstMissingDate.Value Then
MsgBox ("Last Missing Date cannot be less than First Missing Date!")
Cancel = True
End If
End Sub
 

hardhitter06

Registered User.
Local time
Today, 09:00
Joined
Dec 21, 2006
Messages
600
Perfect. Thanks Paul
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 06:00
Joined
Aug 30, 2003
Messages
36,133
No problemo.
 

Users who are viewing this thread

Top Bottom