Using IIf to return a zero value in a text box

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
 
K

Keith W

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top