PC Review


Reply
Thread Tools Rate Thread

DSUM with Between And operator?

 
 
Barbara
Guest
Posts: n/a
 
      16th Apr 2004
Can I use the following in a DSUM function:

xx = DSum("[Amount]", "tblAllCalls", "[CallingNumber]
= '" & searchnumber & "'" AND startdate Between #" &
varbeg & "# And #" & varend & "#")

For some reason I'm getting a syntax error.
tia.
 
Reply With Quote
 
 
 
 
Gerald Stanley
Guest
Posts: n/a
 
      16th Apr 2004
Try

xx = DSum("[Amount]", "tblAllCalls", "[CallingNumber]
= '" & searchnumber & "' AND startdate Between #" &
varbeg & "# And #" & varend & "#")

Hope This Helps
Gerald Stanley MCSD
>-----Original Message-----
>Can I use the following in a DSUM function:
>
>xx = DSum("[Amount]", "tblAllCalls", "[CallingNumber]
>= '" & searchnumber & "'" AND startdate Between #" &
>varbeg & "# And #" & varend & "#")
>
>For some reason I'm getting a syntax error.
>tia.
>.
>

 
Reply With Quote
 
Douglas J. Steele
Guest
Posts: n/a
 
      16th Apr 2004
Also, make sure that the dates are in mm/dd/yyyy, regardless of what your
locale settings are.

If there's a chance that the user's short date format might be dd/mm/yyyy,
change Gerald's suggestion to:

xx = DSum("[Amount]", "tblAllCalls", "[CallingNumber]
= '" & searchnumber & "' AND startdate Between #" &
Format(varbeg, "mm/dd/yyyy") & "# And #" & Format(varend, "mm/dd/yyyy") &
"#")


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(No private e-mails, please)



"Gerald Stanley" <(E-Mail Removed)> wrote in message
news:00ef01c423fa$71e4c230$(E-Mail Removed)...
> Try
>
> xx = DSum("[Amount]", "tblAllCalls", "[CallingNumber]
> = '" & searchnumber & "' AND startdate Between #" &
> varbeg & "# And #" & varend & "#")
>
> Hope This Helps
> Gerald Stanley MCSD
> >-----Original Message-----
> >Can I use the following in a DSUM function:
> >
> >xx = DSum("[Amount]", "tblAllCalls", "[CallingNumber]
> >= '" & searchnumber & "'" AND startdate Between #" &
> >varbeg & "# And #" & varend & "#")
> >
> >For some reason I'm getting a syntax error.
> >tia.
> >.
> >



 
Reply With Quote
 
Gerald Stanley
Guest
Posts: n/a
 
      17th Apr 2004
Doug

Good spot - I was preoccupied with the AND startdate being
outside of the quotes.

Gerald
>-----Original Message-----
>Also, make sure that the dates are in mm/dd/yyyy,

regardless of what your
>locale settings are.
>
>If there's a chance that the user's short date format

might be dd/mm/yyyy,
>change Gerald's suggestion to:
>
> xx = DSum("[Amount]", "tblAllCalls", "[CallingNumber]
>= '" & searchnumber & "' AND startdate Between #" &
>Format(varbeg, "mm/dd/yyyy") & "# And #" & Format(varend,

"mm/dd/yyyy") &
>"#")
>
>
>--
>Doug Steele, Microsoft Access MVP
>http://I.Am/DougSteele
>(No private e-mails, please)
>
>
>
>"Gerald Stanley" <(E-Mail Removed)> wrote in message
>news:00ef01c423fa$71e4c230$(E-Mail Removed)...
>> Try
>>
>> xx = DSum("[Amount]", "tblAllCalls", "[CallingNumber]
>> = '" & searchnumber & "' AND startdate Between #" &
>> varbeg & "# And #" & varend & "#")
>>
>> Hope This Helps
>> Gerald Stanley MCSD
>> >-----Original Message-----
>> >Can I use the following in a DSUM function:
>> >
>> >xx = DSum("[Amount]", "tblAllCalls", "[CallingNumber]
>> >= '" & searchnumber & "'" AND startdate Between #" &
>> >varbeg & "# And #" & varend & "#")
>> >
>> >For some reason I'm getting a syntax error.
>> >tia.
>> >.
>> >

>
>
>.
>

 
Reply With Quote
 
Barbara
Guest
Posts: n/a
 
      17th Apr 2004
Thanks both of you, it works fine now!!!

>-----Original Message-----
>Doug
>
>Good spot - I was preoccupied with the AND startdate

being
>outside of the quotes.
>
>Gerald
>>-----Original Message-----
>>Also, make sure that the dates are in mm/dd/yyyy,

>regardless of what your
>>locale settings are.
>>
>>If there's a chance that the user's short date format

>might be dd/mm/yyyy,
>>change Gerald's suggestion to:
>>
>> xx = DSum("[Amount]", "tblAllCalls", "[CallingNumber]
>>= '" & searchnumber & "' AND startdate Between #" &
>>Format(varbeg, "mm/dd/yyyy") & "# And #" & Format

(varend,
>"mm/dd/yyyy") &
>>"#")
>>
>>
>>--
>>Doug Steele, Microsoft Access MVP
>>http://I.Am/DougSteele
>>(No private e-mails, please)
>>
>>
>>
>>"Gerald Stanley" <(E-Mail Removed)> wrote in

message
>>news:00ef01c423fa$71e4c230$(E-Mail Removed)...
>>> Try
>>>
>>> xx = DSum("[Amount]", "tblAllCalls", "[CallingNumber]
>>> = '" & searchnumber & "' AND startdate Between #" &
>>> varbeg & "# And #" & varend & "#")
>>>
>>> Hope This Helps
>>> Gerald Stanley MCSD
>>> >-----Original Message-----
>>> >Can I use the following in a DSUM function:
>>> >
>>> >xx = DSum("[Amount]", "tblAllCalls", "[CallingNumber]
>>> >= '" & searchnumber & "'" AND startdate Between #" &
>>> >varbeg & "# And #" & varend & "#")
>>> >
>>> >For some reason I'm getting a syntax error.
>>> >tia.
>>> >.
>>> >

>>
>>
>>.
>>

>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
generic problem with operator. compile error: operator * is not allowedon type T. SharpKnight Microsoft C# .NET 2 20th Feb 2006 02:08 PM
The Bang ! operator vs the . operator... Rashar Sharro via AccessMonster.com Microsoft Access Form Coding 10 16th Jun 2005 10:05 PM
I don't know how to use DSum bw Microsoft Access Form Coding 6 18th Apr 2005 09:07 PM
re dsum =?Utf-8?B?Um95?= Microsoft Access Form Coding 0 16th Apr 2005 08:15 AM
C# exponentiation operator & operator overloading David Laub Microsoft C# .NET 2 20th Dec 2003 10:30 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:22 AM.