View Full Version : Helps with dates


Hightower
06-15-2008, 01:02 AM
Hey all,

I need to write a few queries for reports but have no idea how. The situation is I am writing a database for a video store and need to have certain reports. One of that is "Get all members who's expiry month and year equal the current month and year".

I know what the queries should look like in plain English (like above) but don't know how to convert this to the magical language of Access.

I'm sure if anyone can help with this one then the others should be fairly easy to do.

Thanks!

khawar
06-15-2008, 03:18 AM
Assuming your table name is members in which expiry date is stored in field ExpiryDate this would be the sql

SELECT tblMembers.MemberName, tblMembers.ExpiryDate
FROM tblMembers
WHERE (((Month([ExpiryDate]))=Month(Date())) AND ((Year([ExpiryDate]))=Year(Date())));


Regards

Khawar

Hightower
06-15-2008, 05:32 AM
You are a golden god! I love you to bits!