option button in access

E

eleftheriak

Hi all,

Can you please tell me how to make an option button checked in VB?

which event you have to use?

Thanks in advance

Riri
 
E

eleftheriak

My problem is that I have a value in a table which is Y or N if it is Y
I want the to check the check box from Vb propably.

Anyone to help!!!!

Riri
 
R

Rick Brandt

My problem is that I have a value in a table which is Y or N if it is
Y I want the to check the check box from Vb propably.

Anyone to help!!!!

Riri

Is there some reason you don't just use a proper Yes/No field? You can set the
format property so it displays "Y" or "N" and you would be able to bind that
field directly to the ToggleButton and it will automatically show correctly on
the form with no code at all.

Alternatively, you could use the following as a ControlSource of the
ToggleButton...

=(FieldName="Y")

....and again it would track from record to record without the need for code.

If you "must" use a coded solution you would use the following in the form's
Current event...

Me!ToggleButtonName = (FieldName="Y")
 
V

Van T. Dinh

It sounds like your Field is a Text Field storing single character "Y" or
"N".

If is much more efficient and less hassles if you change the Field to a
Boolean (Yes / No) and just bind it to the CheckBox Control.
 
E

eleftheriak

How do I do that?

I have in my table the Y and N and I want the checkbox to be checked in
either case?

Thanks a lot for your help
 
R

Rick Brandt

How do I do that?

I have in my table the Y and N and I want the checkbox to be checked
in either case?

Thanks a lot for your help

So if the field contains "Y" you want the CheckBox (your subject says option
button which is different) "checked" and if the field contains "N" you also want
the CheckBox checked? That would mean that it is always checked would it not?
Or are there other possible values in the field besides "Y" and "N"?

Is the DataType of this field Text or Yes/No?

To "bind" a control to a field means to enter the field name into the
ControlSource property of that control.
 
R

Rick Brandt

I want the Y to be checked and N to uncheck
How do I do that?

You've been given several suggestions already and have been asked some direct
questions that for some reason you refuse to answer. Please keep in mind that
we cannot read your mind nor see your database.
 
Top