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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

New to ADP : help with calculations (pretty urgent)

Status
Not open for further replies.

ThomasVDB

Programmer
Oct 25, 2004
1
BE
Hi,
am pretty new to access projects, and am having trouble making a calculation.

- I have a table (tbl_data) with these fields :
[field1(int)] ; [field2(int] ; [field3(boolean)]

- There is a table (tbl_settings) with these records :
[Name] ; [Value]

- I have also created a function "Coerce(x, min, max)"
that clips a integer with a min and max value.

What I want : To make a calculated text box in the bottom of my form. (Form = list of my records)

the calculation should be a sum of a calculation per record.

result = sum([field1])
This works

but I can't do anything more complex.
result = sum ([field2]-[field1]) or
result = sum ([field1]+1) give "#Error".

What can I do?

Put all calculations in a view?
But how then do I use the public vars and functions that I have?
can I e.g. use an iif-function in a view?

calculation that I need :

result = sum(coerce([field2]-[field1];iif(field3=true;' a looked up value from tbl_settings'; 'another looked up value from tbl_settings'; iif(field3=true;' a looked up value from tbl_settings'; 'another looked up value from tbl_settings' )

thx for all your help !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top