Avatar of egovernment
egovernment
Flag for Afghanistan asked on

Validate textbox control date with variable date

How validate textbox control date with variable date in VBA (ACCESS)
Microsoft AccessProgrammingVisual Basic Classic

Avatar of undefined
Last Comment
Mike McCracken

8/22/2022 - Mon
plummet

Hi

Can you explain exactly what you want to know? Do you want to validate a date variable or are you talking about a variable date?

egovernment

ASKER
For example I have an TextBox can only accept date format as yyyy -mm -dd so how I can validate the date value in text box with date stored in variable with type Date
ASKER CERTIFIED SOLUTION
GrahamSkan

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
plummet

OK, you can compare dates just using the = , for example

if txtDate = cdate("2011-10-08") then print "Dates Match"

or possibly, to make sure there is a date in the text box (I have called it txtDate):

if isdate(txtDate) then
    if txtDate = cdate("2011-10-08") then print "Dates Match"
end if

or to see if the date entered in the textbox is earlier than today:

if isdate(txtDate) then
    if txtDate < now then print "Date is earlier than " & now
end if
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
SOLUTION
plummet

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
egovernment

ASKER
I will check the all answers
Mike McCracken

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.