PC Review


Reply
Thread Tools Rate Thread

Dcount Criteria

 
 
=?Utf-8?B?UGFjbw==?=
Guest
Posts: n/a
 
      29th Apr 2006
Any idea why these two dcounts return different values?

Dcount("*", "tblWR", "Created >= #4/29/2006#") (This returns the correct
count)
Dcount("*", "tblWR", "Created >= " & dtmRequestLimitDate) (This returns a
count of all records)

dtmRequestLimitDate is a public date variable that is set to Date(). It
shows the correct value when the code is run. I have a feeling there is
something about the syntax using a variable that I'm not seeing.

Thanks.
 
Reply With Quote
 
 
 
 
Douglas J. Steele
Guest
Posts: n/a
 
      29th Apr 2006
Just as you surrounded your date with # delimiters (and had it in mm/dd/yyyy
format), so too must you do that with the value you're passing from your
variable:

Dcount("*", "tblWR", "Created >= " & Format(dtmRequestLimitDate,
"\#mm\/dd\/yyyy\#"))

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


"Paco" <(E-Mail Removed)> wrote in message
news:4F6DFF30-D1FC-42D6-A9ED-(E-Mail Removed)...
> Any idea why these two dcounts return different values?
>
> Dcount("*", "tblWR", "Created >= #4/29/2006#") (This returns the correct
> count)
> Dcount("*", "tblWR", "Created >= " & dtmRequestLimitDate) (This returns a
> count of all records)
>
> dtmRequestLimitDate is a public date variable that is set to Date(). It
> shows the correct value when the code is run. I have a feeling there is
> something about the syntax using a variable that I'm not seeing.
>
> Thanks.



 
Reply With Quote
 
=?Utf-8?B?UGFjbw==?=
Guest
Posts: n/a
 
      29th Apr 2006
Perfect. Thanks.

"Douglas J. Steele" wrote:

> Just as you surrounded your date with # delimiters (and had it in mm/dd/yyyy
> format), so too must you do that with the value you're passing from your
> variable:
>
> Dcount("*", "tblWR", "Created >= " & Format(dtmRequestLimitDate,
> "\#mm\/dd\/yyyy\#"))
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no private e-mails, please)
>
>
> "Paco" <(E-Mail Removed)> wrote in message
> news:4F6DFF30-D1FC-42D6-A9ED-(E-Mail Removed)...
> > Any idea why these two dcounts return different values?
> >
> > Dcount("*", "tblWR", "Created >= #4/29/2006#") (This returns the correct
> > count)
> > Dcount("*", "tblWR", "Created >= " & dtmRequestLimitDate) (This returns a
> > count of all records)
> >
> > dtmRequestLimitDate is a public date variable that is set to Date(). It
> > shows the correct value when the code is run. I have a feeling there is
> > something about the syntax using a variable that I'm not seeing.
> >
> > Thanks.

>
>
>

 
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
Using DCount with WHERE criteria HeislerKurt@gmail.com Microsoft Access Form Coding 3 5th Jul 2007 05:43 PM
DCount criteria PadmaBhaskar@gmail.com Microsoft Access Forms 7 26th Jun 2006 07:37 PM
How set this DCount criteria? =?Utf-8?B?TG9uZ1dheUZyb21Ib21l?= Microsoft Access Form Coding 1 1st Jun 2006 10:50 PM
dcount with more than one criteria Vjeran Microsoft Access Queries 3 5th Jan 2006 07:06 PM
Dcount criteria jason Microsoft Excel Worksheet Functions 2 20th May 2004 04:53 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:14 AM.