Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Radio Button Required

Status
Not open for further replies.

jbento

Technical User
Jul 20, 2001
573
0
0
US
Hi All,
I posed this question before, but I'm going to add a little more to it. I hope someone can help a poor soul.

I have been searching for a very long time on this website to try and find, but I can't.
I have a form with 6 radio buttons. I would like to use some code that will alert user that he/she needs to choose one of those radio buttons if he tries to go to another record or exit the form, without choosing one of those radio buttons.

Below are my sample radio buttons:

Radio Button 1
Radio Button 2
Radio Button 3
Radio Button 4
Radio Button 5
Radio Button 6

If none of those radio buttons are selected, I want to use code to alert the user he/she needs to select one or more, but if one is selected, then the code would not run then they can go on to the next area on the form, or go to the next record. If I have all set to Required, that would not work for me, because that would make the user have to select all the radio buttons, when they don’t have to do this. I hope this explains it a little more. Can anyone help me with this one? Your help again, will be greatly appreciated.

Jerome
 
Do the 6 radio buttons all represent 1 field in the database? If so, create an option group, put the radio buttons in there, then set the control source for the option group to your field.

Then, depending on your database/workflow, you can either make the field mandatory, or check for a value in this field on a form event, probably the Before Update event.

The code might look something like this:

if isnull(me!FieldName) then
msgbox "Please select a radio button, meathead"
cancel = true
end if


I hope this helps...

Jeff
 
Jeff,
Thanks so much. I will try this:). This is a big help to me.

Jerome
 
hello,

I am Jmichel, I amm french and my english is not very good, but I have a problem :
Into Javascript, how do you do to recover the value from a radio button "form.name.????"

Thank
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top