Memberships Expired

P

Paul

Ok I used the following to display a list of memberships
expiring in the month.

WHERE ExpiryDt BETWEEN DateSerial(Year(Date()), Month(Date
()), 1) AND DateSerial(Year(Date()), Month(Date()) + 1, 0)

This worked thanks to Douglas J. Steele.

What I need, then my database and assignment is finished
(hurray), is criteria which will show members whose
membership exiry dates are in the past.

Something like = < Date()

Yes I know that wouldnt work.

Please could you help me with the following.

Thank you so much

Paul
 
L

Les

Hi Paul,
I think you just need:

WHERE ExpiryDt <date()

to get all the ExpiryDt which are earlier than the current
date.
Good luck with your project.
 
P

Paul

Thats a good idea - but what I really want is for the
query to pick up records of memberships that expired last
month. So in real life it would be December 03.
 
D

Douglas J. Steele

Play with the criteria in WHERE ExpiryDt BETWEEN DateSerial(Year(Date()),
Month(Date()), 1) AND DateSerial(Year(Date()), Month(Date()) + 1, 0)

DateSerial takes 3 arguments: a year, a month and a day, in that order, and
it's smart enough to let you do arithmetic with the values. For instance,
DateSerial(Year(Date()), Month(Date()) + 1, 0) is the last day of the
current month: DateSerial(Year(Date()), Month(Date()) + 1, 1) gives you the
first day of the next month (even if the current month is December), and
you're subtracting one day from that.

In other words, to get the range of dates in last month, use WHERE ExpiryDt
BETWEEN DateSerial(Year(Date()), Month(Date()) - 1, 1) AND
DateSerial(Year(Date()), Month(Date()), 0)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top