referencing previous record

ggg3ggg

New Member
Joined
Jun 4, 2003
Messages
17
How do you go about subtracting the value of the previous field from todays field.

ie: if field is temp
record number is 100 value =33.2
record number is 101 value is 34.5

result required is 34.5-33.2=1.3
tia
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Put some code in the After Update event procedure of the secondcontrol e.g.

Temp = Me.ControlName1 - Me.ControlName2

No error checking here though! You will have to provide that yourself.


David
 
Upvote 0
I think you are WAY above me here-sorry. Are you talking macros?
Can it be done with the formula builder.
I have a little little experience with VBA for excel but none with Access.
 
Upvote 0
What other fields do you have in your query or table? Is there a date field (you mentioned yesterday and today)?
 
Upvote 0
Ok, I deleted my last post. It was garbage. Here's a better way.

Ok, in your query (in the query design view), right-click on the table that is in your query, and select Properties. Change "Alias" to "X" (no quotes). Then add a field in your query (make sure that your query is sorted ascending by Date) something like this:

Diff: [fldProjNum]-(SELECT fldProjNum from tbl060603b WHERE fldDateIn = (SELECT MAX([fldDateIn]) FROM tbl060603b WHERE [fldDateIn] < X.fldDateIn))

You'll need to change the table and field names - in my query,

tbl060603b is my table
fldProjNum is my "temperature"
fldDateIn is my date

This one does work.

HTH,

Russell
 
Upvote 0

Forum statistics

Threads
1,221,531
Messages
6,160,357
Members
451,642
Latest member
mirofa

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top