Adding the value of two fields when value is null

L

Laura

I am working in a query. I would like to add the value of two fields (OT and
DT) together in a third field. However, sometimes the value of one field is
null, and Access won't calculate a total.

I don't want to change all of the null values to "0" in the original table
(when both fileds have a value, Access doesn't have a problem calculating the
total) - Any suggestions?

Thank you!
 
J

Jellifish

NZ([OT],0)+NZ([DT],0)

NZ is a function which will return a value if the input is null.
 
D

Duane Hookom

You can use:
ExtraTime: Nz([OT],0) + Nz([DT],0)

IMO, OT, DT, and RG should all create separate records in a related table
with a field that store the TimeType.
 
L

Laura

It worked! Thank you SOOOOO much!

Jellifish said:
NZ([OT],0)+NZ([DT],0)

NZ is a function which will return a value if the input is null.


Laura said:
I am working in a query. I would like to add the value of two fields (OT
and
DT) together in a third field. However, sometimes the value of one field
is
null, and Access won't calculate a total.

I don't want to change all of the null values to "0" in the original table
(when both fileds have a value, Access doesn't have a problem calculating
the
total) - Any suggestions?

Thank you!


.
 
L

Laura

It worked! Thank you SOOOOO much!

Duane Hookom said:
You can use:
ExtraTime: Nz([OT],0) + Nz([DT],0)

IMO, OT, DT, and RG should all create separate records in a related table
with a field that store the TimeType.
--
Duane Hookom
Microsoft Access MVP


Laura said:
I am working in a query. I would like to add the value of two fields (OT and
DT) together in a third field. However, sometimes the value of one field is
null, and Access won't calculate a total.

I don't want to change all of the null values to "0" in the original table
(when both fileds have a value, Access doesn't have a problem calculating the
total) - Any suggestions?

Thank you!
 

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