A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Adding the value of two fields when value is null



 
 
Thread Tools Display Modes
  #1  
Old December 22nd, 2009, 08:43 PM posted to microsoft.public.access.queries
Laura
external usenet poster
 
Posts: 458
Default Adding the value of two fields when value is null

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!
  #2  
Old December 22nd, 2009, 08:54 PM posted to microsoft.public.access.queries
Jellifish
external usenet poster
 
Posts: 49
Default Adding the value of two fields when value is null

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

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


"Laura" wrote in message
...
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!



  #3  
Old December 22nd, 2009, 09:01 PM posted to microsoft.public.access.queries
Duane Hookom
external usenet poster
 
Posts: 7,177
Default Adding the value of two fields when value is null

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" wrote:

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!

  #4  
Old December 23rd, 2009, 02:58 PM posted to microsoft.public.access.queries
Laura
external usenet poster
 
Posts: 458
Default Adding the value of two fields when value is null

It worked! Thank you SOOOOO much!

"Jellifish" wrote:

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

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


"Laura" wrote in message
...
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!



.

  #5  
Old December 23rd, 2009, 02:58 PM posted to microsoft.public.access.queries
Laura
external usenet poster
 
Posts: 458
Default Adding the value of two fields when value is null

It worked! Thank you SOOOOO much!

"Duane Hookom" wrote:

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" wrote:

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!

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:20 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.