Hi Guy's yes fixed the issue now thanks to you guy's noticing, also i had some over flow in values when up to a 6 digit number we as set as integer, change it to Long and perfect
there are no decimals or anything and In my experience i thought Integer is a whole number and Long can be split into decimals etc.... ?
However, this works great
Code:
Dim dtStart As Date, dtEnd As DateDim lMilesStart As Long, lMilesEnd As Long, lMilesTotal As Integer
Dim sVeh As String
sVeh = Me.Vehicle
dtStart = InputBox("Enter Start Date ?" & vbCrLf & vbCrLf & _
"Default is 3 Months", "ENTER START DATE", Format(DateAdd("m", -3, Now()), "dd-mm-yyyy"))
dtEnd = InputBox("Enter End Date ?" & vbCrLf & vbCrLf & _
"Default is Now", "ENTER END DATE", Format(Now(), "dd-mm-yyyy"))
lMilesStart = Nz(DMin("Mileage", "tblServiceData", "[FuelDate] > #" & dtStart & "# And [Vehicle] = '" & sVeh & "'"), 0)
Forms!frmService!txtStart = dtStart
lMilesEnd = Nz(DMax("Mileage", "tblServiceData", "[FuelDate] < #" & dtEnd & "# And [Vehicle] = '" & sVeh & "'"), 0)
Forms!frmService!txtMilesStart = lMilesStart
Forms!frmService!txtEnd = dtEnd
Forms!frmService!txtMilesEnd = lMilesEnd
Forms!frmService!txtMilesTotal = lMilesEnd - lMilesStart