Link to home
Start Free TrialLog in
Avatar of Malkadore
Malkadore

asked on

DCount - Datatype missmatch in Criteria

What am I doing wrong?

Me.Text0 = DCount("*", "Table1", "[Field1] = 'Date()'")

 - Malk
Avatar of jmantha709
jmantha709

Me.Text0 = DCount("*", "Table1", "[Field1] = Date()")
ASKER CERTIFIED SOLUTION
Avatar of JohnK813
JohnK813
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Or :

Me.Text0 = DCount("*", "Table1", "[Field1] = #" & Date() & "#")
Avatar of Malkadore

ASKER

Thanks!

 - Malk
Did you try my solution (the first post) it will also work...

Me.Text0 = DCount("*", "Table1", "[Field1] = Date()")
Sorry Jm, I thought I had selected yours, but I guess not.
I'm trying to figure out why #'s were necessary when obviously they aren't looking at your 1st solution.

They would be necessary if you were to pass a variable containing a date like :

Me.Text0 = DCount("*", "Table1", "[Field1] = #" & MyDateVariable & "#")

But there not if your using the date function the way I used it in my first post...
Yeah, I'm using it.

Maybe u can help me with this? and I'll make up for this q.

https://www.experts-exchange.com/questions/21755226/Dcount-If-Statement.html