Full Version: Using current month as criteria
UtterAccess Forums > Microsoft® Access > Access Date + Time
I have been looking around here because I am sure this has been asked before, but I cannot find it.

My question I think is fairly simple, just not sure of the correct syntax

I have a query that has a date column (prom_dock) which I want to use as the main criteria. I only want to pull the information within the current month.

I have been trying different ways about this including month(prom_dock) and month(date). When I try these 2, I am getting a data mismatch error.

If someone could help me, out I would greatly appreciate it.

Edited by: jfreds15 on Fri Jan 13 16:48:10 EST 2006.
What the format of Prom_Dock?
Can you post your SQL?
R. Hicks
It it is a Date datatype field .. use the following as the criteria:
Between DateSerial(Year(Date()),Month(Date()),1) And DateSerial(Year(Date()),Month(Date())+1,0)

The format is month/date/year. I would use the right() function, but the number can vary between 1 and 2 digits.
The date can do the same while the year is a constant 4 digits.
1/1/2002 or 12/3/2005 or 12/31/2005.
This come from a linked table, so I cannot adjust the formatting here.
Does this help, or do you want the SQL? If so, so you want it for the whole query (pretty long since I have a lot of columns)?
Thanks for the help
Did not see your response, but thank you. Trying it now...will let you know the outcome.
That code was what I was looking for...thanks again.
R. Hicks
No problem .. wink.gif
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.