Basic database leaning (1 Viewer)

yanliang

New member
Local time
Yesterday, 21:00
Joined
Sep 10, 2020
Messages
7
Hi, I am a student that just started learning about data and access.
I ran into a problem with creating a rule in the field of CardExpirationDate.
The question is how do I set up a command which tells the people to enter a Credit Card number which pastes or is within 30 days of the current date.
And self calculate the date during the user enter the card expiration date. And if the card is not within less than 30 days, the warning will come up.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 02:00
Joined
Feb 19, 2013
Messages
16,618
credit and debit card expiry dates are normally just expressed and month and year. So depends how you are storing this - as a text value '01/22'? or as a date 01/01/2022 or perhaps 31/01/2022?

assuming it is a date then the formula would be something like cardDate-date<30

if it is text then something like cdate("01/" & cardDate)-date<30

so perhaps in the cardDate after update event something like
Code:
if  cdate("01/" & cardDate)-date<30 then
    msgbox "Unable to process this card as it is within 30 days of expiring"
    'do something here like clear card and card date values
else
    'carry on processing card
end if
 

yanliang

New member
Local time
Yesterday, 21:00
Joined
Sep 10, 2020
Messages
7
thank u so much.
really helpful
 

Users who are viewing this thread

Top Bottom