Sum Function in a Form

  • Thread starter Thread starter Andy jones
  • Start date Start date
A

Andy jones

I have a basic database with a form which includes the
following fields,

Obs Required
Obs completed
Obs remaining

I need to create an automatic calculation on the same form
which subtracts the first two fields above and inputs an
answer into the thrird field.

Ie:
Obs required 4 (user input)
Obs completed 2 (user input)
Obs remaining 2 (Automatic calculation from first two)

Is this possible to do and what formula do I use? I have
tried the help function and i dont really understand it.
If this was excel, i'd have no problems with formulas but
access I have no idea.

It needs to show the calculation on the form if possible.

Can anyone help me on this one?

Thanks
 
Welcome to Access!
As you can see, Access is not Excel, and some of its basic assumptions are
different.

First, a word of warning:
Although Access permits you to put spaces in your field names, it's
really rarely a good idea.
ObsRequired and Obs_Required are both good options.

Now to your question, here's my suggestion:
In your table, remove the Obs_Remaining field.
This is one big difference between Access and Excel. In Access,
values which can be calculated from other, existing values are rarely
stored. Instead, they are always calculated "on the fly", making sure they
are always up to date.
On your form, display the Property Sheet for your third textbox. Change
the ControlSource property of the textbox to this:
=Obs_Required - Obs_Completed

Now your form will always show the calculated value, and will update
automatically when you change either input value.

HTH
- Turtle
 
Back
Top