Easy Access VBA Question

A

Alex

Have a question here. I need the Acess VBA that can do this and I am having
troulbe writing VBA in Access because Excel VBA is my forte:

I created a new column for a sub form. This new column needs to calculate a
value that will be determined by looking at another value in that same row,
as well as using two values from a previous row.

So, in Access VBA I need an If statement that will look something like this:

If [the value in the same row, another column] is 1, then give me a value
off of the main form.

But if [that value in this same row, another column] > 1, then calculate the
new value by subtracting two values in the previous record.

Thanks alot!
 
A

Alex Dybenko

Hi,
you need to have your subform sorted by some unique field, then you can get
previous value by querying (dlookup() for example)underlying table with
unique field < unique field of current row.
 
Top