Syntax error when using Nz in query

  • Thread starter Thread starter Jean
  • Start date Start date
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
 
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
 
Back
Top