View Full Version : DCount and Filter using the Format(xx,yy)


gzuroweste
03-20-2001, 05:26 PM
I am tring to count the records in a specific time frame. The DCount function works fine in counting the total records, until I try to enter my criteria. It still returns total records. I must be using the wrong syntex.

intX = DCount("[No]", "Turrent", (Format(Me.Date, yy) = Format(Now, yy)))

Any help would be nice.




[This message has been edited by gzuroweste (edited 03-21-2001).]

Pat Hartman
03-20-2001, 06:01 PM
It looks like you have named your form field "Date" and your table field "Date". And Access already has a function named "Date". This is beginning to sound like the running joke from the old Bob Newhart Show - "This is my brother Darrel and this is my other brother Darrel".

Be a little more descriptive with your names and NEVER re-use as a name something Access considers a reserved word. If you're in doubt about whether a word is reserved by Access, just look it up in help.

Your DLookUp() might work if you surround the two "Dates" with square brackets. That's a clue to Access that you are referring to an object you named. If that doesn't fix it - rename your objects.