Need help w/ expression

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

Just like in a checkbook, I want to create a report that contains 1 field
plus 1 expression:

- Expenses (field)
- Remaining Balance (expression)

Naturally, I want the Remaining Balance to be dynamically calculated based
on the previous record value in the Expenses field.

Example:

Expenses Remaining Balance
80
20 60
10 50


How do I do that in an expression? If yes, how would such an expression
look
like?

Also, how do I handle the first entry of $80 (beginning balance value)?
 
If you would clarify for us what _data_ you have, and how it is stored, then
perhaps someone could be of help. We can assume you have records, each to be
printed on a line, that contain an expense. We don't have any information
how you are keeping the information on the "balance" or where the initial
balance comes from (from which a "remaining balance" could be calculated).

But, for the purposes of discussion... I assume that from some source, you
can come up with an initial balance number to tuck away, say, in a field
(could be Visible = No, if you wish) in the Report header - call it
txtInitialBalance. If that is the case, then create another Control,
txtExpenseRS with Expense as its Control Source, set its Running Sum
property to Over All, and set its Visible property to No. Then create a
calculated Control for Remaining Balance with a ControlSource of

= txtInitialBalance - txtExpenseRS

Just to make certain I didn't have a problem with some new, stricter Access
version, I'd probably fully qualify the Controls above, as

Forms!<yourformname>!txtInitialBalance

Larry Linson
Microsoft Access MVP
 
Larry:

Thanks for your feedback. At this time, there's nothing really fancy about
the table.

As you already indicated, the report simply pulls each record and writes out
an "expense".

If needed, I could certainly add a primary key (autonumber). Currently, the
account number makes a record unique so I may not need to do that.

Not sure about the "forwarded running balance" yet. Actually, for right
now I shouldn't even worry about this... which should make this problem
easier.

So, I simply need to subtract an expenses from the previous subtotal of
expenses, right?

I am not sure if I understood the "calculated control" advice. Do I do
this in a query? I'd appreciate if you could please provide me more help.

Thanks so much!!!

Tom
 
Back
Top