Solved

Recording mileage on a form

Posted on 2016-11-28
2
35 Views
Last Modified: 2016-11-28
I have a form that has three fields.  "Vehicle Used", "Starting Mileage" and "Ending Mileage".  The "Starting Mileage" field is to show the last entry made in the "Ending Mileage" field UNLESS it is the first record for that vehicle.  In that case the field is to show nothing.

Right now I have this in the control source of the x field but it doesn't work correctly:

=DMax("[EndingMileage]","tblTravel","[VehicleUsedID] = " & Nz([Forms]![frmTravel]![cboVehicleUsedID],0))
0
Comment
Question by:SteveL13
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 500 total points
ID: 41904246
are you storing all three of these values in your table, or just the vehicleUsedID and the EndingMileage?

Personally, I would store all three in the table, bind them to the controls on your form, and use the cboVehicleUsedID AfterUpdate event to populate the value of the StartingMileage field (control).
0
 

Author Closing Comment

by:SteveL13
ID: 41904260
Excellent suggestions.  Thanks.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question