Is there anything strange about NZ function?

G

Guest

I can run my query with NZ function from within Access however cannot run it
via OLEDB connection even though its using Jet DB engine.
Here is my query, I tried changing it to not use NZ but nothing seems to
work the same.

SELECT ID, T1 & IIF(NZ(T2,'')='','','--') & T2 & IIF(NZ(T3,'')='','','--') &
T3 AS KWDesc FROM tblKWFlat ORDER BY T1, T2, T3;

Basically I need three columns if not null to be separated by '--'
e.g.
abc
abc--def
abc--def--ghi

Any ideas?
 
K

Ken Snell \(MVP\)

Nz is a VBA function, and probably isn't available to the database that is
running the query that you want to run?

Try this:

SELECT ID, T1 & IIF(T2 Is Null,"",IIf(T2='','','--')) & T2 & IIF(T3 Is
Null,"",IIf(T3='','','--')) & T3 AS KWDesc FROM tblKWFlat ORDER BY T1, T2,
T3;
 

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