There may be an option to make it a little easier in Access by using the ID. However, it only works if you can absolutely guarantee that consecutive positions have consecutive IDs. In a query you can then more easily link the current record to the previous one and make the calculations. In my example I made the calculation for one field.
Notice that I changed the name of the date field. Date is a reserved word that should not be used as a field name.
I still believe that Excel is your friend.
Code:SELECT Stand.DatePosition, Stand.[Electriciy-Position-High], Stand.[Electriciy-Position-High]-StandVorig.[Electriciy-Position-High] AS ConsumptionHigh FROM Stand LEFT JOIN Stand AS StandVorig ON Stand.ID = StandVorig.ID+1;
Groeten,
Peter
Yes. You do not want the autonumber as random.
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
Thank you Peter,There may be an option to make it a little easier in Access by using the ID. However, it only works if you can absolutely guarantee that consecutive positions have consecutive IDs. In a query you can then more easily link the current record to the previous one and make the calculations. In my example I made the calculation for one field.
Notice that I changed the name of the date field. Date is a reserved word that should not be used as a field name.
I still believe that Excel is your friend.
Code:SELECT Stand.DatePosition, Stand.[Electriciy-Position-High], Stand.[Electriciy-Position-High]-StandVorig.[Electriciy-Position-High] AS ConsumptionHigh FROM Stand LEFT JOIN Stand AS StandVorig ON Stand.ID = StandVorig.ID+1;
These are busy days now, I'm going to try to get the hang of this quickly.
Jaap