DSUM Error

N

NeoFax

I am getting an error with the below DSUM expression:

LeadHours:
IIf([helo#]<41200,nz(DSum("HOURS","tblUnitHours","[STATION]='" &
[STATION] & "' [LongNose]='S'"),
0),nz(DSum("HOURS","tblUnitHours","[STATION]='" & [STATION] &
"' [LongNose]='L'"),0))

It has to do with the quotations around the S and L. Should they be
single or double quotes? Thanks!

Terry
 
D

Dennis

Your problem is in the 3rd section of the DSum statements. This is the
equivalent of a SQL where clause without the where. Should the [LongNose] be
combined with the [Station] as and AND or as an OR
e.g.
nz(DSum("HOURS","tblUnitHours","[STATION]='" & [STATION] &
"' And [LongNose]='L'"),0))
nz(DSum("HOURS","tblUnitHours","[STATION]='" & [STATION] &
"' OR [LongNose]='L'"),0))
 
K

Klatuu

This is the part I don't understand:

"[STATION]='" & [STATION] & "' [LongNose]='L'"),0))

If the value of the field STATION were Bingo, it would translate to:
Bingo[LongNose]=L

Sorry, but that doesn't make sense. What is it you are trying to do?
 
N

NeoFax

Your problem is in the 3rd section of the DSum statements. This is the
equivalent of a SQL where clause without the where. Should the [LongNose] be
combined with the [Station] as and AND or as an OR
e.g.
nz(DSum("HOURS","tblUnitHours","[STATION]='" & [STATION] &
 "' And [LongNose]='L'"),0))
nz(DSum("HOURS","tblUnitHours","[STATION]='" & [STATION] &
 "' OR [LongNose]='L'"),0))



NeoFax said:
I am getting an error with the below DSUM expression:
LeadHours:
IIf([helo#]<41200,nz(DSum("HOURS","tblUnitHours","[STATION]='" &
[STATION] & "' [LongNose]='S'"),
0),nz(DSum("HOURS","tblUnitHours","[STATION]='" & [STATION] &
"' [LongNose]='L'"),0))
It has to do with the quotations around the S and L.  Should they be
single or double quotes?  Thanks!
Terry- Hide quoted text -

- Show quoted text -

I fixed it. I was stupid and forgot to put the and after the single
quote like Dennis states. Need to pay more attention next time.
 

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

Really slow query 2
Slow Crosstab Query 2
SQL Statement - error 12
Dsum and Dmax with structured references 1
Parameter Query with DSum 2
Dsum returns #Error 7
DSUM Syntax Error 1
Dsum Multiple Criteria 4

Top