Get $0.00 to display on a Currency text box on a form

M

magicdds-

I have a form that has a text box whose format is Currency. The control
source is a DLookUp function to a Query. When the result of the DLookUp has a
value, it displays in the text box correctly (i.e.; $234.78). When the
DLookUp returns NULL, the text box on the form is blank. Is there a way to
get the text box to display $0.00 if the DLookUp returns NULL?
 
D

Douglas J. Steele

Wrap the Nz function around your DLookup:

=Nz(DLookup("FieldName", "TableName", "Condition"), 0)
 
M

Maurice

Try adjusting the dlookup as follows:

Me.[field] = Nz(DLookup("lookupvalue", "tablename", "criteriafield" &
criteria), 0)

In this sample change the following to your own situation:

me.field = the field you want the value to store on your form
lookupvalue = the field you are looking for in the table
tablename= your tablename
criteriafield = criteriafield from the form to which the dlookup should do
the search
criteria= the field from the form you are referering

The NZ part tells the Dlookup to place a 0 instead of the Null value. I
assume you have a format set on the form which makes it $0.00

hth
 

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