Combo Box Properties

G

Guest

I have a form with a Combo Box. The options in the Combo Box are either ‘Yes’
or ‘No’. What is the ‘Validation Rule’ I need in the ‘Properties’ box for the
user to either enter ‘Yes’ or ‘No’?

Also, I want the default value to be ‘Yes’, but when I put the word ‘Yes’ in
the ‘Default Value’ field in the ‘Properties’ box, the form shows -1 instead
of ‘Yes’ Can this be fixed?

Thanks
 
G

Guest

If all you want is a Yes or No, a combo box is not a good choice of a control
to use. The simplest control for a binary (Yes/No) choice is a check box.
It will always return True or False. True = -1 and False = 0 (Yes and No)
are not words Access really understands in all cases. They way you are using
it, Yes = True = -1, so it changes it to -1.

If you want a nicer visual presentation for a user that has specific Yes and
No words on the form, then an Option Group with two Toggle Buttons is a good
choice.

To do this, first put an Option Group control on your form. The put two
Toggle Buttons inside the Option Group control. Make the Option Value of one
button -1 and make its Caption Yes. Make the other's Option Value 0 and its
Caption 0. Make the Default Value of the Option Group control -1. Then when
you want to know which button has been selected:
If Me.opgYesNo = True Then
'Do the Yes Stuff
Else
'Do the No Stuff
End If
 
G

Guest

I got the Option Group with two Option Buttons (one for 'Yes' the other one
for 'No'). I am not sure where to put the piece of code you gave me:

If Me.opgYesNo = True Then
'Do the Yes Stuff
Else
'Do the No Stuff
End If
Also, who do I link the option group or the yes and no option buttons to the
querry ?
 
G

Guest

You did not say what you want to do with this control. The code I posted is
only an outline to give you an idea how what the control will return.
If you can tell me what you plan to do, I will be happy to offer a suggestion.
 

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

Top