Syntax error when using Nz in query

J

Jean

Hi all,

I am trying to get this query right, but so far no joy...

I have written the following code in the Field box of the
QBD grid of a query:

firstvalue:IIf(Not (IsNull([Value1])),[Value1],(IIf(Not
(IsNull([Value2])),[Value2],(IIf(Not (IsNull([Value3])),
[Value3],[Value4])))))

What I actually want in field "firstvalue" is the left
most value of Value1, Value2, Value3 and Value4. E.g If
for a record Value1 = 0 (or NULL), then it must return
Value2 or Value3 or Value4, depending on the first one
which is not 0 (or NULL).

I keep getting syntax errors, and specifically pointing to
the first comma in the code.


Can somebody please tell me what is wrong? I can email a
sample DB to someone if they want to check out the table
which the query is based on.

Thanks a bunch, in advance!

JP
 
G

Guest

Solved it now actually,

The problem I had was that I am using a German version of
MS Access, and somehow it did not understand the term Iif.
Strange, cause it can translate other terms, like Nz,
True, IsNull etc.

Regards,

Jean
 

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