Results 1 to 7 of 7
  1. #1
    Daniel2000 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2013
    Posts
    34

    fuel consuption database

    have designed a small access database to monitor fuel consuption. each time we issue a fuel voucher, we record vehicle number plus mileage (meter reading) at start and end and database automatically calculates no of km.

    as of now, users have to enter the meter reading at start and meter reading at end manually using a form.



    what i want is when i choose the car number from my form, then meter reading at start should capture the last meter reading at end as the default meter reading at start. this will be a locked properties and users will not have input access.

  2. #2
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    Try Dmax of the car number.
    example- DMax("[EndindingReading]","TableWithMeterReadings","CarNumber= " & Carnumber)
    This is assuming that car number is a number. You ca also use (recommended) the table PK.

    Dale

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I started a dB a long time ago, but I only enter the ending odometer number. Don't know if this will help, but look at the attached dB. I was trying to learn how to get a value from a previous record.

  4. #4
    Daniel2000 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2013
    Posts
    34
    Thanks Dale and Steve.

    Dale,

    I have tried what you sugegsted but it is not working. My form has the date, Vehicle Number (list in drop down box), meter reading at start, meter reading at end and no of km (which is meter reading at end - meter reading at start). Once entered these data are being updated in table April 13.

    Can you please advise the correct expression to input in meter reading at start so that it picks up the last meter reading at end matching on vehicle number.

    please note that anytime we open the form in edit mode, then previous records should show last meter reading as meter reading at start for that particular date.

  5. #5
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    StartMeterReading=DMax("[EndindingReading]","TableWithMeterReadings","CarNumber= " & Carnumber)


    Dale

  6. #6
    Daniel2000 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2013
    Posts
    34
    Dale, sorry for late response. I was working on another access programme. If I use your argument below it works but will need to amend the argument so that it checks on the date also. Your argument above will pick up max endingreading number all the time.

    say yesterday ending was 10 and today it is 20. your condition above will show 20 on both days. will need to see that if i choose yesterday's record, then it should show max endingmeter as startmeter based on data for that day. more of that, if we entered several in same day, then will need to check on the date and time.


    please advise. Thanks

  7. #7
    Daniel2000 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2013
    Posts
    34
    anyone can help????

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 01-28-2013, 04:42 PM
  2. Replies: 1
    Last Post: 01-16-2013, 12:40 AM
  3. Replies: 5
    Last Post: 05-16-2012, 12:48 AM
  4. Replies: 20
    Last Post: 08-08-2011, 01:34 PM
  5. Replies: 3
    Last Post: 05-15-2011, 10:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums