Full Version: Check Checkbox On Form Load
UtterAccess Forums > Microsoft® Access > Access Forms
joelwebster
Hi all,
oes anyone know of a way to check a checkbox on the load of the form it is on?
Thanks.
Bob_L
In the load event you can use:
e.CheckBoxName = True
joelwebster
Getting an error when I set the On Load property of the form to the suggested code, any ideas?
Freaker
Another way is to set the default property of the check box to =True
That fault are you getting when you set the OnLoad for the form?
Bob_L
Yeah, what is the EXACT code you are using and what is the EXACT error you are getting?
joelwebster
I am putting the code 'Me.chkCourseRunning = True' into the code builder of the 'On Load' box in the property sheet for the form. chkCourseRunning is a hidden checkbox on the form. The error message is attached.
Thanks.
Freaker
No you want to put that in the VBA event, not the field in the box on the form. Hit the drop down in that box on the form and select [Event Procedure], then click the elipses (...) at the right of that control to go into the VBA window. Place the code there.
Bob_L
And here's a visual on what Freaker wrote.
joelwebster
That's what I did, setting its default value to true doesn't work e
Bob_L
Let's actually see a screen shot of where you have the code and what is in the event property dialog as well (so two screenshots).
joelwebster
I should probably mention that the checkbox is bound to a table. But when I tried it with an unbound checkbox I got the same error so it probably doesn't make a difference.
Screenshot attached.
Bob_L
And you have an Actual Checkbox control ON the form and named chkCourseRunning (not just a field)?
AC2Designs
Sounds like it may be a reference issue.
Post a screen shot of:
Tools..References
evin
Bob_L
It also could be a spot of corruption. You might see if IMPORTING everything into a new database shell does anything.
joelwebster
Trying your suggestion now Bob.
Kevin, here is the screenshot attached.
Bob_L
Yeah, references look okay.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.