View Single Post
 
Old August 21st, 2004, 10:49 AM
tlwaltz tlwaltz is offline
Authorized User
 
Join Date: Jun 2004
Location: Cumberland, MD, USA.
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default Faulty Date Logic

Is the IF statement in the code at the top of p.292 correct?

The IF statement ...

If txtEndDate > txtStartDate Then
   'Alert the user and Cancel the update
   Cancel = MsgBox(Start Date must be before the End Date", _
     vbInformation, "Data Validation Failure")
End If

is used to validate that the Start Date is before the End Date (or conversely, that the End Date is after the Start Date). The dates would be invalid if the Start Date were GREATER THAN the End Date.

In order for the code to work correctly, shouldn't the IF statement be changed to ...

If txtStartDate > txtEndDate Then
   'Alert the user and Cancel the update
   Cancel = MsgBox(Start Date must be before the End Date", _
     vbInformation, "Data Validation Failure")
End If



Terry Waltz
__________________
Terry Waltz