Why won't this DSUM work?

  • Thread starter Thread starter Gator
  • Start date Start date
G

Gator

=DSum("[Amount]","Deposits","[DateDep] =#" & [Text21] & "#")

why am I getting "syntax error in date in query expression"?

thanks
 
Try:

with the assumption that [Text21] is the name of a control, not a field, I
would try:

=DSUM("Amount", "Deposits", "[DateDep] = #" & me.text21 & "#")

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.
 
I get the error...
the object doesn't contain the automation object 'me'

Dale Fye said:
Try:

with the assumption that [Text21] is the name of a control, not a field, I
would try:

=DSUM("Amount", "Deposits", "[DateDep] = #" & me.text21 & "#")

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.



Gator said:
=DSum("[Amount]","Deposits","[DateDep] =#" & [Text21] & "#")

why am I getting "syntax error in date in query expression"?

thanks
 
I got it....
=DSum("Amount","Deposits","[DateDep] = #" & [text21] & "#")

thanks

Gator said:
I get the error...
the object doesn't contain the automation object 'me'

Dale Fye said:
Try:

with the assumption that [Text21] is the name of a control, not a field, I
would try:

=DSUM("Amount", "Deposits", "[DateDep] = #" & me.text21 & "#")

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.



Gator said:
=DSum("[Amount]","Deposits","[DateDep] =#" & [Text21] & "#")

why am I getting "syntax error in date in query expression"?

thanks
 
so, is "text21" actually a field name?

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.



Gator said:
I got it....
=DSum("Amount","Deposits","[DateDep] = #" & [text21] & "#")

thanks

Gator said:
I get the error...
the object doesn't contain the automation object 'me'

Dale Fye said:
Try:

with the assumption that [Text21] is the name of a control, not a field, I
would try:

=DSUM("Amount", "Deposits", "[DateDep] = #" & me.text21 & "#")

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.



:

=DSum("[Amount]","Deposits","[DateDep] =#" & [Text21] & "#")

why am I getting "syntax error in date in query expression"?

thanks
 
at this point...it is....

Dale Fye said:
so, is "text21" actually a field name?

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.



Gator said:
I got it....
=DSum("Amount","Deposits","[DateDep] = #" & [text21] & "#")

thanks

Gator said:
I get the error...
the object doesn't contain the automation object 'me'

:

Try:

with the assumption that [Text21] is the name of a control, not a field, I
would try:

=DSUM("Amount", "Deposits", "[DateDep] = #" & me.text21 & "#")

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.



:

=DSum("[Amount]","Deposits","[DateDep] =#" & [Text21] & "#")

why am I getting "syntax error in date in query expression"?

thanks
 
I get the error...
the object doesn't contain the automation object 'me'

Dale Fye said:
Try:

with the assumption that [Text21] is the name of a control, not a field, I
would try:

=DSUM("Amount", "Deposits", "[DateDep] = #" & me.text21 & "#")

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.

Gator said:
=DSum("[Amount]","Deposits","[DateDep] =#" & [Text21] & "#")

why am I getting "syntax error in date in query expression"?

thanks

You cannot use the "Me" keyword within the control source of an Access
control or in a query.
"Me" can only be used in VBA.

Your original post states that the DSUM was used in a query (not
directly as the control source of a control).
You do NOT use the = sign in a query expression.
ColumnName:DSum(etc....)

Also, you would need to fully qualify the [Text21] control's address.

ColumnName:DSum("[Amount]","Deposits","[DateDep] = #" &
forms!FormName![Text21] & "#")

So, assuming [DateDep] is a Date Datatype and [Text21] contains a
valid date, the above should work.
 
Gator said:
=DSum("[Amount]","Deposits","[DateDep] =#" & [Text21] & "#")

why am I getting "syntax error in date in query expression"?

thanks

If this is in a query leave the equal sign off
This will result in exp1:DSum("[Amount]","Deposits","[DateDep] =#" &
[Text21] & "#")
and you can rename exp1 to something meaningful
 
Back
Top