PaulA
02-04-2010, 11:15 AM
Hi, all--
I am using the following expression in a report text box and getting an error:
=IIf(IsNull([BMI-2]),"N/A",Round([BMI-2],1))
I am wanting to have decimals fixed at one place and, this being an expression, I get varying decimal places. I thought the "round" function would be used, but I'm getting the error.
Suggestions?
Thanks.
Brianwarnock
02-04-2010, 11:43 AM
You do not say what the error is.
Is BMI-2 the calculation or the name of the control.
Brian
PaulA
02-04-2010, 11:46 AM
Good point. I get "#Error" in the field and the BMI-2 is the name of the control.
Thanks.
Rename the control txtBMI2 and then still use the FIELD name: [BMI-2] in the IIf statement.
On reports you need to use the field and not the control, if bound.
Also, don't use special characters in your names like that. That can cause issues even if you bracket, depending on where it is. The only character to use is an underscore ( _ ) if you need to.
PaulA
02-04-2010, 11:53 AM
Again, good points.
Thanks.
PaulA
02-04-2010, 12:07 PM
Ii made the suggested changes and am still getting the error.
Here's the expression:
=IIf(IsNull([BMI2]),"N/A",Round([BMI2],1))
Did you actually change the FIELD names to be BMI2 in the table?
PaulA
02-04-2010, 12:36 PM
I changed the field names in the query. The query field itself has an expression:
BMI2: IIf([MinofAssessDate]=[MaxofAssessDate],"N/A",[BMIL]).
The report control name is txtBMIL.
Brianwarnock
02-05-2010, 06:06 AM
Di it all in the query, as it stands you could end up trying to round "N/A".
BMI2: IIf([MinofAssessDate]=[MaxofAssessDate],"N/A",IIf(IsNull([BMIL]),"N/A",Round([BMIL],1)))
Brian
How can you put a text value in a numeric field?
Brianwarnock
02-05-2010, 08:39 AM
BMI2 will be a text field.
Brian
Then how can it be Rounded?:confused:
Brianwarnock
02-05-2010, 08:48 AM
Ah! the mysteries of ACCESS, obviously its by magic, but it does.
Brian