Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Tweaking a calculated field in a query

7 views
Skip to first unread message

menke...@gmail.com

unread,
Dec 4, 2013, 1:55:45 PM12/4/13
to
Hi, I have a calculated field in my query called "Test" and here is the equation.
Test: [overhead]+[travel]
Unfortunately if the travel column is blank it gives me no result. It's like Access is saying, "Hey, unless I see numbers in both overhead AND travel I'm not giving you a sum number. Is there a way that I can get a result in the cell even if the travel column holds no value?
Thanks very much.

John W. Vinson

unread,
Dec 4, 2013, 4:37:42 PM12/4/13
to
Yes, you can use the builtin NZ() - Null To Zero - function:

Test: NZ([overhead]) + NZ([travel])

NZ also has an optional second argument if zero isn't what you want: e.g.

TaxAmount: [SaleAmt] * NZ([TaxRate], 1)

--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com

menke...@gmail.com

unread,
Dec 5, 2013, 10:39:17 AM12/5/13
to
Awesome, thanks very much.

Access Developer

unread,
Dec 5, 2013, 9:40:44 PM12/5/13
to
<menke...@gmail.com> wrote

> Awesome, thanks very much.

John's a pretty "awesome" guy when it comes to Access, databases, computer
applications, and a whole host of other topics.

--
Larry



Ulrich Möller

unread,
Dec 15, 2013, 6:30:28 PM12/15/13
to
Ensure that none of the both fields contains a NULL value and use the
"&" operator instead the "+".

Ulrich

0 new messages