Formula in a text box

U

Ulcom

Hi

First, happy new year and thanks to everybody for helping

OK, I have a simple table with 2 fields "date" and "amount" (numeric field)

I have a continuoius form wher I input data every day. so I have something
looking like Excel....many rows and 2 columns.

Is it possible to add a text box with a mathematical formula to obtain a
total . So I would have a third column called "cumulative"
This total would be the ("amount" of the record + the sum of the "amount" of
all previous records)
I guess it could be also the ("amount" of the record + "cumulative" of the
previous record)

Date Amount Cumulative
1-jan-05 10 10
2-jan-05 4 14
3-jan-05 8 22

thanks
 
A

Aliensmurf

Here is what you want too do
Fist add your new column called Cumulative
First you are going to want to create a new form based on your Table
You may use the form wizard. Make your form in datasheet view.

Pull in your Form Header and Footers by clicking on View.

In the footer you are going to create an unbound text box. Bring up the
Properites for the text field.
On the Data Tab for the control source put =sum([amount]) Where amount
is replace it with the name of your field that stores the amount you enter.
On the Other Tab for the Name put sum

Now pull up the properites for the amount field.
Goto the Event Tab
On the After Update event enter the following:

Me.Cumulative.Value = [sum] + [amount]

Where amount is this will the the name of your amount field.
Where Cumulative is this will be the name of your Cumulative field.

Save the form.

You will notice that when you enter a number in the amount field the
Cumulative field will automatically update with your required information.

If you want to keep a person from changing the value in the Cumulative field
you can go into the properites of the field. Click on the Data Tab. Where it
says Locked change it to yes.

If you have any questions please ask, I have done this and know it will
work.
Aliensmurf
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top