A site for solving at least some of your technical problems...
A site for solving at least some of your technical problems...
In MS-Access, you often want to run an action after the user changed something in a form.
For instance, if they click on the Shipping button, you want to change the address to the shipping address instead of the billing address. If you have a button, you create an event procedure with the name Shipping_Click() (assuming that your button is called Shipping.) That procedure is then in charge of swapping the address as required.
The same happens with text boxes for which you generally will use the AfterUpdate event (instead of checking each time someone types a character which can be really slow and make the typing annoying and you also are likely to lose the focus in some way.)
Now I installed a checkbox because I wanted to mark a part of my form one way or another. Depending on the setup, the form changes slightly and the content changes dramatically. Thus I have to have a VBA script that takes over and re-arrange the form for me.
When looking at the events that are available to Check Boxes I could not see one that would mean "after update" or "on change". I was a little bit dismayed but remembered that I made it work with the billing/shipping selection using radio buttons. That works with a frame and the frame receives the current status.
Sure enough, I added a frame (called Option Group, by the way...) to my form and cut and copied my checkbox inside that frame. Now, I could add a procedure event to the frame for the AfterUpdate event!
Then I test... and it does not work correctly. That is, instead of being a check box button, it became a radio button: you can select it, you cannot deselect it.
The fact is that an Option Group is only for radio buttons, not for check buttons! Well... there may be some cases when having a check box in an Option Group is sensical, but otherwise you just need to create them outside. To do so, select the Checkbox, then hit Ctrl-X and Ctrl-V. This brings the checkbox outside the Option Group. If you look closer, you will notice that the AfterUpdate event now appears directly inside the list of events of the Checkbox! Isn't that beautiful?
Now it works as expected! Enjoy!
Recent Posts on The Linux Page: