Solved

Recording mileage on a form

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

829 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