X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
   Reply to this topicStart new topic
> Please Help A Struggling Newbie, Access 2016    
post Jan 15 2020, 05:38 PM

Posts: 2
Joined: 6-July 19

I know this must have been covered before but I'm really struggling with this.
I want to calculate MPG between fill ups for one vehicle only.
I have a table that has the following fields:

fuel ID Gallons Odometer TankMiles
1 12 19340
2 6 19680
3 8 20458

How do I calculate the TankMiles column.
I know I have to get the Odometer value from the previous record then subtract that from the latest one.
I am trying to use the expression builder to create a new field called TankMiles but i am struggling with formula and syntax.
I am trying to use Dlookup and Dmax but its not working for me.
I may have to delete a record at some stage and then the ID will be out of sequence so I know I have to account for this.
I am sorry to burden you all with such a stupid newbie question but I have looked all over the internet and I think I am struggling as much with the question and just can't find the answer.

Go to the top of the page
post Jan 15 2020, 05:55 PM

UtterAccess VIP
Posts: 2,088
Joined: 4-June 18
From: Somerset, UK

Crossposted with a reply at https://www.access-programmers.co.UK/forums...ad.php?t=308991

Colin (Mendip Data Systems)
Website, email
Go to the top of the page
post Jan 15 2020, 05:56 PM

Posts: 1,153
Joined: 25-January 16
From: The Great Land

See if this helps http://allenbrowne.com/subquery-01.html#AnotherRecord

Actually, ID gap is irrelevant.

This post has been edited by June7: Jan 15 2020, 05:56 PM

Attachments Manager is below the edit post window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Go to the top of the page
post Jan 15 2020, 06:02 PM

UA Admin
Posts: 36,515
Joined: 20-June 02
From: Newcastle, WA

Welcome to UtterAccess.

We all started somewhere, so there's no reason to apologize or feel bad about asking "newbie questions". It's the way we learn, as a matter of fact.

If you have trouble applying the solution illustrated in the Allen Browne article, post back and we'll delve in further.
This post has been edited by GroverParkGeorge: Jan 15 2020, 06:03 PM

My Real Name Is George. Grover Park Consulting is where I did business for 20 years.
How to Ask a Good Question
Beginning SQL Server
Go to the top of the page
post Jan 16 2020, 08:46 AM

Posts: 2
Joined: 6-July 19

thank you so much for your kind help and advice
Go to the top of the page

Custom Search

RSSSearch   Top   Lo-Fi    20th January 2020 - 10:39 PM