Validating Credit Card style date

G

Guest

I would like to set a table level validation rule for a clients credit card
EXP date.

Ideally I would like to have a rule that would check whether the exp date
provided was at the very least current on the date of entry.

How does one go about creating a validation rule that would check "todays
date" against a credit card style exp date (ie. 03/06) (month / yr )

Any ideas?

Thanks
 
A

Allen Browne

Cards are valid to the last day of the expiry month, so you could parse the
year and month out, add a month, and subtract a day to get the last valid
date. If that's already gone, the card is expired:

With Me.[Exp Date]
If DateSerial(Year(Right(.Value,2), Left(.Value,2) + 1, 0) < Date Then
MsgBox "Card expired."
End If
End With

Hmm: You can try doing that same kind of thing at the table level.
 

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