Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MicroSoft Access

Status
Not open for further replies.

janpan

MIS
Feb 6, 2003
1
0
0
US
Is there a way to calc a prev record. Just say I want 2% of the prev total
 
Not exactly sure what you're doing but why not simply add another field to you query or form where newtotal=[prevtotal] * .02
 
Depends on whether you mean in Access or by using VB. I have never found a way in Access by itself to query a record and apply its values to a different record. But if you go into VB, then you can open a recordset and store the value for a record into a variable, do the math you want, then save the result in a subsequent record of your selection.

I remember trying to do this when I was just starting with Access and it was very frustrating not to be able to find a way.
 
You could use a scratch table with an autonumber field. Clear the table, Append new data (not make table,) do a self-join.

OR:
Many years ago I saw a SQL statement (Sybase) that produced
1
2
3...

I don't recall the syntax, but you might find it on a SQL site or board.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top