[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 197
  • Last Modified:

set control value before loading the form

I am loading a form in access database called "add"..before loading this form I want to set all the checkboxes on this form to value 0. I mean empty white small checkboxes..The code to load is given below..please add the code to set the check boxes.

'stDocName = "Search"
'DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.OpenForm "Add", , , stLinkCriteria

Thank you.
  • 2
1 Solution
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
You'd want to do this in the Load or Open even of your from named "Add":

Sub Form_Load()
  Me.YourCheckboxName = False
  Me.YourNextCheckbox = False
End Sub
Alternate method is that you can predefine the state of checkbox. that is by default value is zero which you can set by properties of checkbox.

Chetan Sachdeva
AiyshaAuthor Commented:

I want to change the default value to zero, but for I dont know what reason, the properties of the checkbox does not have the default value option.
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
The checkbox is part of an Option Group, and in this scenario only the Option Group (i.e. Frame) has a Default value.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now