Using IIf to return a zero value in a text box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using a form to display information to the user. The text box concerned
is part of a subform based on an underlying query. The form works perfectly
well unless the results of the query return no data. I have tried using the
following expressions to force in a zero to the text box without success.
What is displayed is a blank field.

IIf([Adjustment] Is Null,0,Sum([Adjustment]))
IIf(IsEmpty([Adjustment] = TRUE,0,Sum([Adjustment]))
IIf([Adjustment] = "",0,Sum([Adjustment]))

I referring to the result of this text box in an other control in the form
to calculate an overall total. When the query returns no data the overall
total box shows #error.

Can anybody offer any assistance
 
Marshall P at Falkirk said:
I am using a form to display information to the user. The text box
concerned
is part of a subform based on an underlying query. The form works
perfectly
well unless the results of the query return no data. I have tried using
the
following expressions to force in a zero to the text box without success.
What is displayed is a blank field.

IIf([Adjustment] Is Null,0,Sum([Adjustment]))
IIf(IsEmpty([Adjustment] = TRUE,0,Sum([Adjustment]))
IIf([Adjustment] = "",0,Sum([Adjustment]))

I referring to the result of this text box in an other control in the form
to calculate an overall total. When the query returns no data the overall
total box shows #error.

Can anybody offer any assistance

Try this:

IIf(IsNull([Adjustment]),0,Sum([Adjustment]))

Regards,
Keith.
www.keithwilby.com
 
Back
Top