Solved Autocheck a check box in a form (1 Viewer)

AGNewton5

Registered User.
Local time
Today, 09:09
Joined
Aug 20, 2019
Messages
28
I am wanting to auto populate a checkbox when a specific textbox has a date in it.
The textbox is named DateOf Course
The checkbox is named PassFail

The date doesn't need to be a specific date, I have a separate validation point for doing that, I just want to make sure that a valid date is entered before the check is populated. any help would be greatly appreciated!

Thank you in advance,

Adam
 

theDBguy

I’m here to help
Staff member
Local time
Today, 07:09
Joined
Oct 29, 2018
Messages
21,358
Hi. Maybe something like.
Code:
Me.CheckboxName = IsDate(Me.DateboxName)
 

moke123

AWF VIP
Local time
Today, 10:09
Joined
Jan 11, 2013
Messages
3,852
Not sure if its a typo " DateOf Course " (Date of course?) but if the field name is "Date" it is a reserved word and should be changed. If the field is "DateOf" then nevermind.
 

AGNewton5

Registered User.
Local time
Today, 09:09
Joined
Aug 20, 2019
Messages
28
Not sure if its a typo " DateOf Course " (Date of course?) but if the field name is "Date" it is a reserved word and should be changed. If the field is "DateOf" then nevermind.
It was a typo. I meant to type DateOfCourse.

Thank you for your help!
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 22:09
Joined
May 7, 2009
Messages
19,175
Code:
The IsDate function does not validate a date/time value.
All it does is determine if, by some means,
no matter how much effort it takes,
VBA can manage to interpret the data you send it as a date.
It may not be a valid date or a reasonable one,
but VBA will be able to convert it into some type of date value.

For example, try pass-ing “3a1-2-3” to IsDate—it returns True.
Then try passing the same value to the DateValue and TimeValue functions
,you may be surprised at the results.

p.157
VBA Developer's Handbook, 2nd Edition
Ken Getz
Mike Gilbert
 

theDBguy

I’m here to help
Staff member
Local time
Today, 07:09
Joined
Oct 29, 2018
Messages
21,358
Code:
The IsDate function does not validate a date/time value.
All it does is determine if, by some means,
no matter how much effort it takes,
VBA can manage to interpret the data you send it as a date.
It may not be a valid date or a reasonable one,
but VBA will be able to convert it into some type of date value.

For example, try pass-ing “3a1-2-3” to IsDate—it returns True.
Then try passing the same value to the DateValue and TimeValue functions
,you may be surprised at the results.

p.157
VBA Developer's Handbook, 2nd Edition
Ken Getz
Mike Gilbert
Hi Arnel. I'm not sure I understand the point of your post. Care to elaborate? Thanks!
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 22:09
Joined
May 7, 2009
Messages
19,175
check this if this is a valid date:

IsDate("3a1-2-3")
DateValue("3a1-2-3")
TimeValue("3a1-2-3")

as what the Book states, IsDate() function does not test if the Expression is a Valid date.
it test if the expression , somehow, can be converted to a valid date.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 07:09
Joined
Oct 29, 2018
Messages
21,358
check this if this is a valid date:

IsDate("3a1-2-3")
DateValue("3a1-2-3")
TimeValue("3a1-2-3")

as what the Book states, IsDate() function does not test if the Expression is a Valid date.
it test if the expression , somehow, can be converted to a valid date.
Just curious, do you really think someone would enter 3a1-2-3 in a textbox for a date?

Or, is your point the IsDate() function can't be trusted, so the OP is better off not using it? If so, do you have any recommendations?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 22:09
Joined
May 7, 2009
Messages
19,175
there maybe some "unfamiliar" users of access up to this date.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 07:09
Joined
Oct 29, 2018
Messages
21,358
there maybe some "unfamiliar" users of access up to this date.
Oh, I see. You were just trying to make others aware, right? Thanks!

Did the book offer any suggestions?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 22:09
Joined
May 7, 2009
Messages
19,175
no suggestions, only Warning.
 

Happytobealive

New member
Local time
Today, 10:09
Joined
Oct 8, 2021
Messages
21
Hi,
Is there a way to do this if a continuous subform contains a word?
subform name: InsuranceListsbfrm
on the subform Column name: InsType
on the subform Specific word: Medicaid
on the main form checkbox: medicaidcheckbox

When the subform contains that word it should tick the checkbox.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 07:09
Joined
Oct 29, 2018
Messages
21,358
Hi,
Is there a way to do this if a continuous subform contains a word?
subform name: InsuranceListsbfrm
on the subform Column name: InsType
on the subform Specific word: Medicaid
on the main form checkbox: medicaidcheckbox

When the subform contains that word it should tick the checkbox.
Hi. Please, let's just continue the already ongoing discussion in your other thread. Thank you.

(1) Main form to show a banner or a checkbox if continuous form contains a specific word | Access World Forums (access-programmers.co.uk)
 

Users who are viewing this thread

Top Bottom