Merging query with Nz to Word

J

Jordan

I have a query that does calculations and has several
fields that contain the Nz() function. I need it for the
obvious reason that some of the fields the calculations
are based on may contain null values, and a null result
does nothing for me. However, when I try to link my
documents to this database using OLE DB, this particular
query won't come up on the Table/Query List, and I've
figured out that it's because of the Nz() function. Does
Word not like Nz? Is there any other way I can
accomplish the task of getting non-null values in my
calculations but still link to Word without using a DDE
link?
 
B

Brian Camire

Try using

IIf(IsNull([Your Field]),[Value If Null],[Your Field])

instead of

Nz([Your Numeric Field],[Value If Null])

Unlike IIf, Nz is an Access-specific function.
 
J

Jordan

Duh! Thanks for that one, even though I should've
figured it out. Does the fact that Nz is Access specific
mean that it cannot be used by other programs?
-----Original Message-----
Try using

IIf(IsNull([Your Field]),[Value If Null],[Your Field])

instead of

Nz([Your Numeric Field],[Value If Null])

Unlike IIf, Nz is an Access-specific function.


I have a query that does calculations and has several
fields that contain the Nz() function. I need it for the
obvious reason that some of the fields the calculations
are based on may contain null values, and a null result
does nothing for me. However, when I try to link my
documents to this database using OLE DB, this particular
query won't come up on the Table/Query List, and I've
figured out that it's because of the Nz() function. Does
Word not like Nz? Is there any other way I can
accomplish the task of getting non-null values in my
calculations but still link to Word without using a DDE
link?


.
 
B

Brian Camire

The short answer is that it cannot be used directly by other programs.

The longer answer goes something like this...

The Nz function is actually a method of the Access "Application" object. If
you really wanted to, you could create an instance of an Access
"Application" object from another application and call the Nz function. For
example, executing the following lines from the Immediate pane of the Visual
Basic Editor window in Word:

Set objApplication = CreateObject("Access.Application")
Debug.Print objApplication.Nz(Null, 1)

will print a "1" in the Immediate pane.

However, this is a very expensive way of doing something that can be done in
a lot more simply by using IIf and IsNull (and, unlike IIf and IsNull, will
not work in a query either).

Jordan said:
Duh! Thanks for that one, even though I should've
figured it out. Does the fact that Nz is Access specific
mean that it cannot be used by other programs?
-----Original Message-----
Try using

IIf(IsNull([Your Field]),[Value If Null],[Your Field])

instead of

Nz([Your Numeric Field],[Value If Null])

Unlike IIf, Nz is an Access-specific function.


I have a query that does calculations and has several
fields that contain the Nz() function. I need it for the
obvious reason that some of the fields the calculations
are based on may contain null values, and a null result
does nothing for me. However, when I try to link my
documents to this database using OLE DB, this particular
query won't come up on the Table/Query List, and I've
figured out that it's because of the Nz() function. Does
Word not like Nz? Is there any other way I can
accomplish the task of getting non-null values in my
calculations but still link to Word without using a DDE
link?


.
 

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

Similar Threads

Nz function 0
NZ function 1
NZ([value],0) query export & Calculations 1
QRY FORMULA ISSUE 4
Dealing with NULL values - NZ function 1
NZ function in query? 1
Using NZ Function to return ALL records 4
Nz 10

Top