inputing calculations

D

Diogo

Hi, I've a doubt.
I'm using a form to input some numeric values in a table.
How do I make the form accept calculations inputs?
example: 445+54698+2128+798....
It would be very helpfull, so that I don't have to sum them up by hand,
before storing them in the table.
Thanks.
 
J

Jeff Boyce

Diogo

It sounds like you want to use a spreadsheet instead of MS Access. Is there
a reason something like Excel won't do what you need to do?

By the way, if the value that you want to store is actually a calculated
value (e.g. 445+54698+...), you might not need to store the sum. Instead,
if each row has one value, you could use a query to add them. That's how
you'd do it in Access...

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
M

missinglinq

It sounds like you want a simple calculator to run up a sum before entering
the totaled value in the table. If you only need to store the total, you
don't need to store the various amounts.

Place unbound text boxes for entering the amounts, call them Amt1, Amt2 and
Amt3.
Set their Format Properties to General Number.
Decide how you want to trigger the calculation i.e. when you click on the
totals field or if you want you can add a button to click to do the
calculation. Behind whichever event you choose to trigger the calculation
place this code:

Totals.Value = Amt1 + Amt2 + Amt3

where Totals is the name of your field that you want stored in your table.
 
J

Jeff Boyce

The disadvantage to this "spreadsheetly" approach is when there are MORE
than 3 values. You have to modify the design of your form, and modify the
function/code that does the calculation. This is a lot of maintenance.


Regards

Jeff Boyce
Microsoft Office/Access MVP
 
M

missinglinq via AccessMonster.com

Naturally, you should decide at the beginning the maximum numbers of values
you'll ever need to add together. My example with three values was just that,
an example! I assumed Diogo would know enough to adapt it to the his needs.
 
J

Jeff Boyce

My point was that fixing on some number (3, 6, 9, 100) is still fixing on
some number. It isn't necessary to do with a relational database, and, in
the long run, is counterproductive.

I subscribe to the notion that as soon as I set "n" (the maximum number of
fields I'll need), some user will come along with a real world example of
n+1!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
A

Anthos

I subscribe to the notion that as soon as I set "n" (the maximum
number of
fields I'll need), some user will come along with a real world example
of
n+1!


I agree with this totally,
This is how I would do it to get around the limited fields method.

Create a table called calculations,
It would have a field in there that would relate it back to the parent
calculation that you wish to use.
Then it would also have a field for calculation value (ie 5 for +5 and
-5 for subtraction of five from the final sum(calcvalue) total.

If this requires further clarification let me know.

Regard
Anthony.
 
Top