Adding Plus/Minus Sign to Calculated Control in Report

  • Thread starter Thread starter JDB
  • Start date Start date
J

JDB

I am trying to add a '+' and '-' to a calculated control.

=IIf([txtq1pre]-[txtq1post]>=0,"+", "-") returns the appropriate sign.

However, when I try to add something after the sign, the control return a
huge number.

For example, =IIf([txtq1pre]-[txtq1post]>=0,"+" &
([txtq1pre]-[txtq1post]),"-"&([txtq1pre]-[txtq1post])) yields a large
number, when the underlying two numbers [txtq1pre] and [txtq1post] are both
less than 5.

Any help on my syntax?
 
JDB said:
I am trying to add a '+' and '-' to a calculated control.

=IIf([txtq1pre]-[txtq1post]>=0,"+", "-") returns the appropriate sign.

However, when I try to add something after the sign, the control return a
huge number.

For example, =IIf([txtq1pre]-[txtq1post]>=0,"+" &
([txtq1pre]-[txtq1post]),"-"&([txtq1pre]-[txtq1post])) yields a large
number, when the underlying two numbers [txtq1pre] and [txtq1post] are both
less than 5.


You syntax is fine, but depending on what you mean by "huge
number", you calculation and/or formatting may be off.

For example, if the numbers are floating point numbers then
you have to decide how you want to round and display the
result. It might be as simple as:
=IIf(txtq1pre- txtq1post >0, "+", "") & Format(txtq1pre -
txtq1post, "0.00")
 
Back
Top