W
Walter
This is the code that for some reason isn't following standard mathematical
logic. In my current record, Me.Odometer = 869343. The last Odometer
entered was 869330. My Invalid Odometer message pops up. I put a code break
to see what's happening. varPrevOdometer is showing 869330 and Me.Odometer
is showing 869343. However, it's still going thru the steps as if 869343 is
less than 869330. The values in the "if is less than" step are correct. Can
you please explain to me when the greater than, less than rules changed??
Why is it cancelling and calling the error message?
Private Sub Odometer_BeforeUpdate(Cancel As Integer)
Dim varPrevOdometer As Variant
varPrevOdometer = Me.Parent!PrevOdometer
If Me.Odometer < varPrevOdometer Then
Cancel = True
Me.Odometer.SelStart = 0
Me.Odometer.SelLength = Len(Me.Odometer.Value)
MsgBox _
"The last odometer entered for this truck was " & _
varPrevOdometer & vbCrLf & _
"Please enter an odometer greater than or equal " & _
"to this.", , _
"Invalid Odometer Entry"
Else
Cancel = False
End If
End Sub
logic. In my current record, Me.Odometer = 869343. The last Odometer
entered was 869330. My Invalid Odometer message pops up. I put a code break
to see what's happening. varPrevOdometer is showing 869330 and Me.Odometer
is showing 869343. However, it's still going thru the steps as if 869343 is
less than 869330. The values in the "if is less than" step are correct. Can
you please explain to me when the greater than, less than rules changed??
Why is it cancelling and calling the error message?
Private Sub Odometer_BeforeUpdate(Cancel As Integer)
Dim varPrevOdometer As Variant
varPrevOdometer = Me.Parent!PrevOdometer
If Me.Odometer < varPrevOdometer Then
Cancel = True
Me.Odometer.SelStart = 0
Me.Odometer.SelLength = Len(Me.Odometer.Value)
MsgBox _
"The last odometer entered for this truck was " & _
varPrevOdometer & vbCrLf & _
"Please enter an odometer greater than or equal " & _
"to this.", , _
"Invalid Odometer Entry"
Else
Cancel = False
End If
End Sub