Have Yes/No checkbox on form; need radio button instead

R

Rachel Garrett

I have a field that is set to the Yes/No data type. It appears on the
form as a check box. I would prefer that it be a radio button. What is
the easiest way to create a Yes/No radio button and still have its
data be associated with that field?

Thanks,
Rachel G.
 
M

Marco

I'll try to help you but I dn't know if I can.

I should create a group option.

then with some select case

case 1
if option1.value =true then txt="hello"
case2
if option2.value =true then txt="Goodbye"
end select

What do you think?

Marco
 
R

Rachel Garrett

I'll try to help you but I dn't know if I can.

I should create a group option.

then with some select case

case 1
   if option1.value =true then txt="hello"
case2
   if option2.value =true then txt="Goodbye"
end select

What do you think?

Marco






- Show quoted text -

Marco,

Thanks for the reply.

(1) What is creating a group option? I've already tried creating two
radio buttons and looking for ways to make them a group. I'm not
finding a way how.

(2) When I say these are in a form, I mean I have a form that was
created from an existing query. If I put your code into the SQL query,
that doesn't solve the problem of giving the user two radio buttons to
choose from. Only "txt" would be available for the form.

I would like to know what controls I have to add to the form, and what
VBA code I would have to add to the form, in order to allow the user
to select a radio button next to the word "Yes" and have the field
value be "Yes", or select a radio button next to the word "No" and
have the field value be "No."

Thanks,
Rachel
 
M

Marco

HI.

in the toolbox toolbar there's a control qith that name Option Group.

You cannot create seperated radio buttons because they don't stay grouped
and work together.

then you can use the code that I sent with the select case.

the something like:

case1

id radio1.value = true then checkfield=Yes




Marco
 
B

BruceM

Use the toolbox to add an option group (rectangle) to the form. Add two
radio buttons within the option group. Assign one radio buttons the Option
Value -1, and the other Option Value 0. This will correspond to the values
Access uses for Yes and No: -1 and 0. However, if you are planning to
store nulls (neither Yes nor No) you would do best not to use a Yes/No
field. Since you are using the option values -1 and 0 you should be able to
convert the Yes/No field to a number field. Bind the option group (not the
radio buttons) to this Number field.
You will be storing a number rather than the text, but you can convert it as
needed in a query or text box expression, or with VBA.
For another take on Yes/No fields, see:
http://allenbrowne.com/NoYesNo.html


I'll try to help you but I dn't know if I can.

I should create a group option.

then with some select case

case 1
if option1.value =true then txt="hello"
case2
if option2.value =true then txt="Goodbye"
end select

What do you think?

Marco






- Show quoted text -

Marco,

Thanks for the reply.

(1) What is creating a group option? I've already tried creating two
radio buttons and looking for ways to make them a group. I'm not
finding a way how.

(2) When I say these are in a form, I mean I have a form that was
created from an existing query. If I put your code into the SQL query,
that doesn't solve the problem of giving the user two radio buttons to
choose from. Only "txt" would be available for the form.

I would like to know what controls I have to add to the form, and what
VBA code I would have to add to the form, in order to allow the user
to select a radio button next to the word "Yes" and have the field
value be "Yes", or select a radio button next to the word "No" and
have the field value be "No."

Thanks,
Rachel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Radio Buttons in Subforms 2
Radio Button Default Value Problem 10
use Radio Button to separate Records 8
Option Groups 5
Radio buttons 3
Radio Button output 3
radio button help 3
Radio Button Macro 3

Top