Solved

Recording mileage on a form

Posted on 2016-11-28
2
25 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

867 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now