By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,677 Members | 1,070 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,677 IT Pros & Developers. It's quick & easy.

Help with multiple criteria DCount and Date Field

P: 27
I am trying to use the following code, but I think there is an error in my syntax:

Count = DCount("[Status In]", "Change Dates", "[Status In] = '" & [Forms]![Main]![New] & "' AND CVDate(Int( #" & [Date] & "# )) = #" & (Date) & "#")

I believe that this is the particular problem area:

CVDate(Int( #" & [Date] & "# ))

I've been messing with this for awhile now and it's just not working properly.

I'm trying to count the number of occurences in the [Status In] field within "Change Dates" where the [Status In] field within "Change dates" is a particular value on the form and the [Date] field within "Change Dates" is the current date.
Dec 12 '06 #1
Share this Question
Share on Google+
3 Replies

Expert Mod 10K+
P: 14,534
Will the following not work ...

Expand|Select|Wrap|Line Numbers
  1. Count = DCount("[Status In]", "Change Dates", "[Status In] = '" & [Forms]![Main]![New] & "' AND [Date] = Date()")
Dec 12 '06 #2

P: 27
That was actually my first course of action, but unfortunately it will not work because the [Date] field has the date stored in it as a general date (date and time) format, but I only care about comparing it to the current day. I've used the CVDate(Int([Date])) code elsewhere to parse only the date from the field, but in this instance it does not seem to want to work.

Thank you for the reply!
Dec 13 '06 #3

P: 27
Nevermind, I finally got it to work. I swear I had tried this syntax yesterday and it didn't want to work...but this is what I ended up with.

Count = DCount("[Status In]", "Change Dates", "[Status In] = '" & [Forms]![Main]![New] & "' AND CVDate(Int([Date])) = Date()")

Thank you!
Dec 13 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.