Control Source Problems

  • Thread starter Thread starter Eddy
  • Start date Start date
E

Eddy

I am using the following code as a control source for a control on a report.
=IIf([Page]=1, [Amount1],Null)

It works fine on page 1 the amount is put in otherwise its null.
The problem occurs when I change the control source to the following:

=IIf([Page]=1,"13 " & [Amount1],Null)

The field now displays the 13 and spaces but the amount now shows no decimal
places. It is Fixed with 2 decimal places. The decimal places show up fine
in the first example but when control source is changed the decimal places
no longer appear.

Can this be done.
 
try...
=IIf([Page]=1,"13 " & format$([Amount1],"0.00"),
Null)

or something similar
-----Original Message-----
I am using the following code as a control source for a control on a report.
=IIf([Page]=1, [Amount1],Null)

It works fine on page 1 the amount is put in otherwise its null.
The problem occurs when I change the control source to the following:

=IIf([Page]=1,"13 " & [Amount1],Null)

The field now displays the 13 and spaces but the amount now shows no decimal
places. It is Fixed with 2 decimal places. The decimal places show up fine
in the first example but when control source is changed the decimal places
no longer appear.

Can this be done.



.
 
If you are using a numeric format on the text box, the first example works
because you are feeding it a number.

Because of the concatenation in the second example, you are giving the text
box text and it can't apply the numeric formatting.

You need to pre-format your number before the concatenation.

In the IIf's second argument, try:

"13 " & Format([Amount1], "#.##")

Good luck.

Sco
 
Depending on what you want, you might want part of both my and Chris's
answers.

Mine won't always give you two decimal positions. Chris's will.

Question is, do you want a leading zero? Chris's will, mine won't.

You might try "#.00"

Two decimal places with no leading zero.

Sco
 
Back
Top