470,815 Members | 1,160 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,815 developers. It's quick & easy.

Help with multiple criteria DCount and Date Field

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
3 8883
14,534 Expert Mod 8TB
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
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
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.

Similar topics

2 posts views Thread by Susan Bricker | last post: by
3 posts views Thread by Saxman | last post: by
47 posts views Thread by Jo | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.