Microsoft Access VBA Macro Programming

(Tina Sui) #1
You can now enter code for when the user ticks the check box or unticks it:

Sub MyCheckbox(control As IRibbonControl, pressed As Boolean)
MsgBox pressed
End Sub


When the user activates the check box, you will get a message box displaying “True,”
which becomes “False” when the box is deactivated. You can insert appropriate code here to
deal with the check box being checked or unchecked by the user.
You can also use your ribbon control to capture user input by including an edit box in your
ribbon control.
To do this, add the following XML below your check box XML code:


<editBox id="Editbox 1 "
label="Editbox sample"
onChange="MyChange"/>


Note that in the case of the edit box, there is noonActionevent. Instead, there is an
onChangeevent. This different event can be confusing to the first-time user, but one of the
ways of checking is to click the Generate Callbacks button. If you enteronActioninstead of
onChange, you will get an error message.
Your overall XML should now look like this:





insertAfterMso="TabHomeAccess">



Free download pdf