What's wrong with this expression?

A

Andrew

Sum: Format(DSum("Qty*Cost","tblItems","ItemID<=" & [ItemID] & " AND
req"),"£#,##0.00")

Futher information.

Access 2002.
Based on the following table tblItems.
Query uses another expression qty*cost to produce a total.
The Query is supposed to produce a running sum based on the field "req" set
to yes.

Thanks in advance.

Andy
 
G

Gary Walter

Andrew said:
Sum: Format(DSum("Qty*Cost","tblItems","ItemID<=" & [ItemID] & " AND
req"),"£#,##0.00")

Futher information.

Access 2002.
Based on the following table tblItems.
Query uses another expression qty*cost to produce a total.
The Query is supposed to produce a running sum based on the field "req" set
to yes.
Hi Andrew,

Would you mind humoring me
and test the following construction
(I could be all wet)

DSum("[Qty]*[Cost]","tblItems",
"(ItemID<=" & [ItemID] & ") AND ([req] = -1)"

Thanks,

Gary Walter
 
G

Gary Walter

Whoops...missing final parenthesis.

DSum("[Qty]*[Cost]","tblItems",
"(ItemID<=" & [ItemID] & ") AND ([req] = -1)")

Gary Walter said:
Andrew said:
Sum: Format(DSum("Qty*Cost","tblItems","ItemID<=" & [ItemID] & " AND
req"),"£#,##0.00")

Futher information.

Access 2002.
Based on the following table tblItems.
Query uses another expression qty*cost to produce a total.
The Query is supposed to produce a running sum based on the field "req" set
to yes.
Hi Andrew,

Would you mind humoring me
and test the following construction
(I could be all wet)

DSum("[Qty]*[Cost]","tblItems",
"(ItemID<=" & [ItemID] & ") AND ([req] = -1)"

Thanks,

Gary Walter
 
A

Andrew

Gary, sorry I stll get an #Error


Gary Walter said:
Whoops...missing final parenthesis.

DSum("[Qty]*[Cost]","tblItems",
"(ItemID<=" & [ItemID] & ") AND ([req] = -1)")

Gary Walter said:
Andrew said:
Sum: Format(DSum("Qty*Cost","tblItems","ItemID<=" & [ItemID] & " AND
req"),"£#,##0.00")

Futher information.

Access 2002.
Based on the following table tblItems.
Query uses another expression qty*cost to produce a total.
The Query is supposed to produce a running sum based on the field "req" set
to yes.
Hi Andrew,

Would you mind humoring me
and test the following construction
(I could be all wet)

DSum("[Qty]*[Cost]","tblItems",
"(ItemID<=" & [ItemID] & ") AND ([req] = -1)"

Thanks,

Gary Walter
 
G

Gary Walter

Hi Andrew,

I might try "divide and conquer"
to find what it is choking on.

try

DSum("[Qty]","tblItems")

DSum("[Qty]*[Cost]","tblItems")

DSum("[Qty]*[Cost]","tblItems", "([req]= -1)")

DSum("[Qty]*[Cost]","tblItems", "(ItemID<=" & [ItemID] & ")")

Please post back if all these work properly.

Gary

Andrew said:
Gary, sorry I stll get an #Error


Gary Walter said:
Whoops...missing final parenthesis.

DSum("[Qty]*[Cost]","tblItems",
"(ItemID<=" & [ItemID] & ") AND ([req] = -1)")

Gary Walter said:
Sum: Format(DSum("Qty*Cost","tblItems","ItemID<=" & [ItemID] & " AND
req"),"£#,##0.00")

Futher information.

Access 2002.
Based on the following table tblItems.
Query uses another expression qty*cost to produce a total.
The Query is supposed to produce a running sum based on the field "req" set
to yes.

Hi Andrew,

Would you mind humoring me
and test the following construction
(I could be all wet)

DSum("[Qty]*[Cost]","tblItems",
"(ItemID<=" & [ItemID] & ") AND ([req] = -1)"

Thanks,

Gary Walter
 
M

Michael Hopwood

Try changing the field name from "Sum" to "MySum", if this fixes it then you
can assume that "Sum" is a reserved word and should not be used for field
names!
 

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