dates and times comparisons

pattyt

Registered User.
Local time
Today, 14:47
Joined
Aug 10, 2001
Messages
13
Please help! I have 4 dates on my form named hlpdate, hlptime, fixdate, fixtime. I need to make sure my fixdate and fixtime are later than my hlpdate and hptime. I have code on the after update for my fixdate field something like this...

Private Sub FIXDATE_AfterUpdate()
If FIXDATE < HLPDATE Then
MsgBox ("The Fix Date must be Later or equal to the Help Date")
FIXDATE = ""
Me.FIXDATE.SetFocus
End If

End Sub

1. Please tell me the code to use to check that my fixtime is later than my hlptime. I know the dates need to be involved also.
2. In the above code it clears out my fixdate but moves to the next field even though I tell it to setfocus on the fixdate.
thnaks alot!
 
Private Sub FIXDATE_BEFOREUpdate
If FIXDATE < HLPDATE Then
MsgBox ("The Fix Date must be Later or equal to the Help Date")
Cancel=TRUE
end sub

Private Sub FIXTIME_BEFOREUpdate
If FIXTIME < HLPTIME and FIXDATE<>HLPDATE Then
MsgBox ("The Fix Time must be Later or equal to the Help Time")
Cancel=TRUE
end sub
 
Private Sub FIXTIME_BEFOREUpdate
If FIXDATE=HLPDATE Then
if fixtime<hlptime then
MsgBox ("The Fix Time must be Later or equal to the Help Time")
Cancel=TRUE
end if
end if
end sub
 

Users who are viewing this thread

Back
Top Bottom