The Linux Page

Radio Buttons in MS-Access

Radio Button in MS-Access

In MS-Access, it is possible to make use of Radio Buttons. They work just like in any other system. The last selected radio button represents the result of the selection. The problem is: how do you make multiple radio buttons work in concert?

Your first reaction is to simply add some radio buttons on your form. That looks fine. Seems to work actually. Somehow they are shown in a "3rd state". That state actually shows you that the radio buttons are not initialized. So it is not helpful in any way.

So... Now we have a radio button and... you try to change its value with a macro. You will see that does not work. The system refuses to change (read/write) the value of a radio button. You will get an error. What's next?


In order for the radio buttons to work in MS-Access, you first want to create a frame (frames are called Option Groups in MS-Access). Then you add the radio buttons inside that frame. And you should not add any other object in that frame. You will see that you are adding them in that frame because the frame background changes color (by negating the background colors.)

Each radio button can be given a name, although that is not too important (unless you want to hide them or access them for some reasons.)

The frame needs to be given the name of the variable you want to use in your macros. That's where the last radio button value is saved. You should edit each radio button value. For a Yes/No type, remember that Yes is -1 and No is 0. To setup a default, you probably want to set the frame to a valid default value. If your database is linked to the form, then make sure that the field cannot be set to Null otherwise it won't work as expected (you won't have a default, none of the radio will be selected.)

If you need some quite peculiar handling, you probably want to write macros anyway.