djeans Posted October 10, 2003 Posted October 10, 2003 I am trying to create a database that will help me keep track of the miles that i drive and fuel used as well as fuel efficiency. I have a field labeled 'Current Mileage' and another labeled 'Previous Mileage'. What I would like to have happen is: Each new record created, the 'previous mileage' would automatically populate with the number that was in the 'current mileage' field in the previous record. Is this possible? thanks darron
DonH Posted October 10, 2003 Posted October 10, 2003 It is possible, but maybe a better way is to do it by dates. This gives you more flexibility if later you want to calculate the mileage for say a given year. But to do what you want to do, you make your layout with 1 entry needed, your current mileage. You also have the field PREVIOUS which pulls the mileage currently stored in your db. Then you can have a button that runs a script that makes the calculation for mileage and replaces the mileage with the CURRENT mileage. I believe tho that using mileage by dates would be best tho. You just need to have 3 fields. DATE, MILEAGE, MPG. MPG would be a calculated field based on the mileages selected by dates. You could do so much this way. Charts, graphs, comparisons, etc etc.
Mike D. Posted October 13, 2003 Posted October 13, 2003 One way to do this is to put the current mileage into a global field before creating the new record, then set the previous mileage field with the value in the global field. Set Field [gMileage, Current Mileage] New Record/Request Set Field [Previous Mileage, gMileage] HTH, Mike
Jim McKee Posted October 13, 2003 Posted October 13, 2003 Mike ... I'd add a couple of steps before yours: Show all records Sort (on Current Mileage, ascending) Go to Record/Request [Last] then your steps: Set Field [gMileage, Current Mileage] New Record/Request Set Field [Previous Mileage, gMileage] and finally Go To Field ["Current Mileage"]
Mike D. Posted October 13, 2003 Posted October 13, 2003 Jim, Works for me. Hope it works for Darron. Mike
Recommended Posts
This topic is 7782 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now