switch a radiobutton with vba code?

  • Thread starter Thread starter A.J.M. van Rijthoven
  • Start date Start date
A

A.J.M. van Rijthoven

Is it possible to switch/press a radiobutton with vba code??

I have radiobuttons a-z and a 'show everything ' button to seacrh for
records.
Besides searching for records with the radiobuttons I made a textbox
with a searchbutton. When this searchbutton is pressed I want to press
a verry small radiobutton (with code) so that the 'show everything'
button can be selected.

Is that possible?
 
It's not quite clear what you want to do. What do you mean "a textbox with
a searchbutton"? In any case, pressing a command button can run any code
you add to the click event for that button. You don't need to press the
radio button with code, you need the code to include whatever exactly
happens when you press the radio button. If you need the same code to run
from several places you could click Insert > Procedure from a code window,
then call that procedure from other places. For instance, a public
procedure named FindAll that finds all records could be called from a
command button's Click event: Call FindAll.
You could use code to hide or unhide a botton, if that is what you need to
do. You will need to be clearer about your requirements if you need a more
specific answer.
 
OK,
All the searchfunctions worl perfectly.
What I want is that, when i press the searchbutton, the state of one
button in an option group (26 buttons that act like radiobuttons) is
changed from down (pressed) to up.
 
If the button is a toggle button you can add the following to the search
button's click event:
Me.tglYourButton = 0
(where tglYourButton is the toggle button's name). You can also use -1
instead of 0 in other code to set it back to a pressed appearance.
If it is a command button I don't have anything to suggest other than
changing it to a toggle button.
 
Back
Top