G
Guest
I have a table which is used to track mileages. What I am trying to do is if
there are records present, get the hightest mileage reading and insert it
into the form field. If the user is inputting the first record, I want 0
(zero) to be inserted into the field. Below is the code I have created for
this but I get an 'Invalid use of Null' error message. Can someone help me
correct the code please? Thank you.
Private Sub StatDate_Exit(Cancel As Integer)
Dim StrtMiles As Variant
StrtMiles = DMax("[OdometerEnding]", "[Statistics]")
If IsNull(StrtMiles) Then
StrtMiles = 0
Me.Start = StrtMiles
Else
Me.Start = StrtMiles
End If
End Sub
there are records present, get the hightest mileage reading and insert it
into the form field. If the user is inputting the first record, I want 0
(zero) to be inserted into the field. Below is the code I have created for
this but I get an 'Invalid use of Null' error message. Can someone help me
correct the code please? Thank you.
Private Sub StatDate_Exit(Cancel As Integer)
Dim StrtMiles As Variant
StrtMiles = DMax("[OdometerEnding]", "[Statistics]")
If IsNull(StrtMiles) Then
StrtMiles = 0
Me.Start = StrtMiles
Else
Me.Start = StrtMiles
End If
End Sub