antifashionpimp
08-04-2004, 06:43 AM
Hi,
I am having a few problems with this one query. What I want to do is return the left-most value which is recorded in a table/query. I am using the Nz function, and keep getting syntax errors.
With this I mean, for example:
I have a table with the following
ID----Value1----Value2----Value3----Value4
-------------------------------------------
1-----3----------NULL-------4-------NULL
2-----NULL--------8---------4-------6
3-----NULL-------NULL------2-------NULL
4-----4------------9--------NULL----4
(I include a sample DB attached at the bottom to express myself better than this dodgy table model above :D )
Now what I want in this query, is a calculated field, e.g. FIRSTVALUE, which checks the left most value in the table/query and returns it.
E.g it should do the following:
For ID=1, FIRSTVALUE=3
For ID =2 FIRSTVALUE=8
FOR ID=3, FIRSTVALUE=2
For ID=4, FIRSTVALUE=4
I was suggested in using the Nz() function, and what I did was enter the following in the field box of the QBD grid:
FIRSTVALUE:Nz([Value1], Nz([Value2], Nz([Value3], [Value4])))
I keep getting syntax errors though, saying that a character is missing etc.
Please can someone help me either to get the right syntax for this, or suggest another(maybe better?) way of getting the info i need(which is the most-left value)
Kind Regards,
JP
I am having a few problems with this one query. What I want to do is return the left-most value which is recorded in a table/query. I am using the Nz function, and keep getting syntax errors.
With this I mean, for example:
I have a table with the following
ID----Value1----Value2----Value3----Value4
-------------------------------------------
1-----3----------NULL-------4-------NULL
2-----NULL--------8---------4-------6
3-----NULL-------NULL------2-------NULL
4-----4------------9--------NULL----4
(I include a sample DB attached at the bottom to express myself better than this dodgy table model above :D )
Now what I want in this query, is a calculated field, e.g. FIRSTVALUE, which checks the left most value in the table/query and returns it.
E.g it should do the following:
For ID=1, FIRSTVALUE=3
For ID =2 FIRSTVALUE=8
FOR ID=3, FIRSTVALUE=2
For ID=4, FIRSTVALUE=4
I was suggested in using the Nz() function, and what I did was enter the following in the field box of the QBD grid:
FIRSTVALUE:Nz([Value1], Nz([Value2], Nz([Value3], [Value4])))
I keep getting syntax errors though, saying that a character is missing etc.
Please can someone help me either to get the right syntax for this, or suggest another(maybe better?) way of getting the info i need(which is the most-left value)
Kind Regards,
JP