Converting a null value to a predetermined text value

  • Follow


I have a query where some results may be null.  In this case, is it possible 
to set a criteria to allow the query to return a result for a null value to 
equal some text value?

For example:  If null then = "Unreviewed"

Thanks
Jim
0
Reply Utf 2/22/2008 8:27:03 PM

Something like this in a query should work.

ReviewStatus: NZ([TheField],"Unreviewed")
-- 
Jerry Whittle, Microsoft Access MVP 
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


"Jimball" wrote:

> I have a query where some results may be null.  In this case, is it possible 
> to set a criteria to allow the query to return a result for a null value to 
> equal some text value?
> 
> For example:  If null then = "Unreviewed"
> 
> Thanks
> Jim
0
Reply Utf 2/22/2008 8:34:01 PM

Jim,

Yes.  The NZ( ) function will convert a NULL value to some predetermined (or 
dynamically determined value.

SELECT Field1, Field2, NZ(Field3, "Default Value") as Field3a
FROM yourTable

HTH
Dale
-- 
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



"Jimball" wrote:

> I have a query where some results may be null.  In this case, is it possible 
> to set a criteria to allow the query to return a result for a null value to 
> equal some text value?
> 
> For example:  If null then = "Unreviewed"
> 
> Thanks
> Jim
0
Reply Utf 2/22/2008 8:34:01 PM

Jimball:

Had a similar issue a few days ago and Conan (MS) and I had a discussion 
going back and forth.  Please see 2/21 "populating null value" from 
Kristibaer.  There are a few ideas there that all worked but I actually came 
up with one that even the pro said "well that shouldn't work, but if it does 
and it isn't broke, don't fix it".

Good luck.

"Jimball" wrote:

> I have a query where some results may be null.  In this case, is it possible 
> to set a criteria to allow the query to return a result for a null value to 
> equal some text value?
> 
> For example:  If null then = "Unreviewed"
> 
> Thanks
> Jim
0
Reply Utf 2/23/2008 5:56:01 PM

3 Replies
1021 Views

(page loaded in 0.035 seconds)


Reply: