View Full Version : Date Query Help


bacarat
06-25-2007, 01:57 PM
Hi Everyone,
I have a query that I would like to show the date only if it expires on the current month. I am not sure on how to format the code. Any help would be great. The field name i want to query is (Expire Date). So if expire date = this month and year then i would like it to show in the query, Thanks Again.

pbaldy
06-25-2007, 02:09 PM
WHERE Month(ExpireDate) = Month(Date()) AND Year(ExpireDate) = Year(Date())

bacarat
06-25-2007, 03:12 PM
Thanks, Im getting an invalid syntax on the WHERE Month(ExpireDate) first part of the code?

pbaldy
06-25-2007, 03:15 PM
What exactly do you have? I've tested that and it works fine.

bacarat
06-25-2007, 03:36 PM
Ok, I have a my query "Expire this month" with "first name" field, "last name" field, and "Expire Date" Field. the table row is set to my main table :Facility acess: I do not have the totals row on. When i put in the code i copies what you had and inserted it into the "field" row like this: =WHERE Month(ExpireDate) = Month(Date()) AND Year(ExpireDate) = Year(Date())

i think i may be typing it wrong. Does the first part of code WHERE Month(ExpireDate) need to be inserted into another area. Im sorry im rather new at this type of code entry. Thanks Alot.

pbaldy
06-25-2007, 03:40 PM
Ah; delete my stuff and get your query back where it was. Then click on View/SQL View. You should see something like

SELECT ...
FROM ...

directly below that, add what I posted earlier. You'll have to change the field name from ExpireDate to whatever yours actually is. If you have the inadvisable space in your field name, you'll need to bracket the name ([...]).

bacarat
06-25-2007, 03:46 PM
Awsome! Thanks so much.