Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Why won't this DSUM work?

Geek News

Why won't this DSUM work?
Gator 11/24/2008 3:29:01 PM
=DSum("[Amount]","Deposits","[DateDep] =#" & [Text21] & "#")

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

thanks
RE: Why won't this DSUM work?
Dale Fye 11/24/2008 3:36:05 PM
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" wrote:

[Quoted Text]
> =DSum("[Amount]","Deposits","[DateDep] =#" & [Text21] & "#")
>
> why am I getting "syntax error in date in query expression"?
>
> thanks
RE: Why won't this DSUM work?
Gator 11/24/2008 3:43:03 PM
I get the error...
the object doesn't contain the automation object 'me'

"Dale Fye" wrote:

[Quoted Text]
> 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" wrote:
>
> > =DSum("[Amount]","Deposits","[DateDep] =#" & [Text21] & "#")
> >
> > why am I getting "syntax error in date in query expression"?
> >
> > thanks
RE: Why won't this DSUM work?
Gator 11/24/2008 3:52:03 PM
I got it....
=DSum("Amount","Deposits","[DateDep] = #" & [text21] & "#")

thanks

"Gator" wrote:

[Quoted Text]
> I get the error...
> the object doesn't contain the automation object 'me'
>
> "Dale Fye" wrote:
>
> > 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" wrote:
> >
> > > =DSum("[Amount]","Deposits","[DateDep] =#" & [Text21] & "#")
> > >
> > > why am I getting "syntax error in date in query expression"?
> > >
> > > thanks
RE: Why won't this DSUM work?
Dale Fye 11/24/2008 4:01:04 PM
so, is "text21" actually a field name?

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.



"Gator" wrote:

[Quoted Text]
> I got it....
> =DSum("Amount","Deposits","[DateDep] = #" & [text21] & "#")
>
> thanks
>
> "Gator" wrote:
>
> > I get the error...
> > the object doesn't contain the automation object 'me'
> >
> > "Dale Fye" wrote:
> >
> > > 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" wrote:
> > >
> > > > =DSum("[Amount]","Deposits","[DateDep] =#" & [Text21] & "#")
> > > >
> > > > why am I getting "syntax error in date in query expression"?
> > > >
> > > > thanks
RE: Why won't this DSUM work?
Gator 11/24/2008 4:07:02 PM
at this point...it is....

"Dale Fye" wrote:

[Quoted Text]
> so, is "text21" actually a field name?
>
> --
> HTH
> Dale
>
> email address is invalid
> Please reply to newsgroup only.
>
>
>
> "Gator" wrote:
>
> > I got it....
> > =DSum("Amount","Deposits","[DateDep] = #" & [text21] & "#")
> >
> > thanks
> >
> > "Gator" wrote:
> >
> > > I get the error...
> > > the object doesn't contain the automation object 'me'
> > >
> > > "Dale Fye" wrote:
> > >
> > > > 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" wrote:
> > > >
> > > > > =DSum("[Amount]","Deposits","[DateDep] =#" & [Text21] & "#")
> > > > >
> > > > > why am I getting "syntax error in date in query expression"?
> > > > >
> > > > > thanks
Re: Why won't this DSUM work?
fredg <fgutkind[ at ]example.invalid> 11/24/2008 4:15:01 PM
On Mon, 24 Nov 2008 07:43:03 -0800, Gator wrote:

[Quoted Text]
> I get the error...
> the object doesn't contain the automation object 'me'
>
> "Dale Fye" wrote:
>
>> 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" wrote:
>>
>>> =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.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Re: Why won't this DSUM work?
"Mike Painter" <mddotpainter[ at ]sbcglobal.net> 11/24/2008 5:48:51 PM
Gator wrote:
[Quoted Text]
> =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


Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net