W
Walter
What is wrong in the following code to give this error? The
"Exit_ValidateOdometer" line is highlighted blue.
Private Sub ValidateOdometer(Cancel As Integer)
On Error GoTo Err_ValidateOdometer
'verify that odometer entry is not less than last
Dim varPrevOdometer As Variant
Set 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"
End If
Exit_ValidateOdometer
Exit Sub
Err_ValidateOdometer:
MsgBox Err.Number & Err.Description
Resume Exit_ValidateOdometer
End Sub
"Exit_ValidateOdometer" line is highlighted blue.
Private Sub ValidateOdometer(Cancel As Integer)
On Error GoTo Err_ValidateOdometer
'verify that odometer entry is not less than last
Dim varPrevOdometer As Variant
Set 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"
End If
Exit_ValidateOdometer
Exit Sub
Err_ValidateOdometer:
MsgBox Err.Number & Err.Description
Resume Exit_ValidateOdometer
End Sub