By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,761 Members | 1,878 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,761 IT Pros & Developers. It's quick & easy.

Link two Fields

P: 10
I am newbie working on Access.
I am asked to create a new database screen with "Letter Variables" as the field name.
Letter variables is a radio button with Yes and No fields.
If an Yes radio button is selected, additional fileds
variable name ( a text box),
Variable type ( a text box) ,
variable field name( a text box),
Variable Format ( a text box),
must be visible and the user must be able to enter data into these text boxes. and when a No radio button is selected, the user is not allowed to enter the data into these text boxes.

I am using forms and created radiobuttons with Yes or No fields. and also created the text boxes in the forms. Now Could any body explain me how to assosiate the radio button field with the textbox field.
Jan 26 '09 #1
Share this Question
Share on Google+
2 Replies

Expert 100+
P: 489
First off you need to create an option group to hold your yes/no radio buttons. and then add the radio buttons to the option group.

By default the option value property is set to 1 for the first radio button added 2 for the next and so on, or you can change them to whatever order you want.

You can set either the yes or no buttons as the default for the option group. If you select the yes radio button as the default make sure that the enabled property is set to yes for all of the controls that you want enabled , if you set no as the default then make sure that the controls enabled propertys are set to no

I'll assume that you have set yes = 1 and no = 2 and the option group name = Letter_Variables.

You would add code something like the following into the after update event of the Letter_Variables control. FieldName1.... would be whatever the names of the text fields are that you want to control. you could also use the .visible property if you want to hide/show them.

Expand|Select|Wrap|Line Numbers
  1. Select Case Me.Letter_Variables
  2. Case = 1       'Yes button selected
  3. me.FieldName1.Enabled = true
  4. me.FieldName2.Enabled = true
  5. me.FieldName3.Enabled = true
  6. and so on.......
  8. Case = 2       'No button selected
  9. me.FieldName1.Enabled = false
  10. me.FieldName2.Enabled = false
  11. me.FieldName3.Enabled = false
  12. and so on.......
  14. Case Else
  15. Exit Sub
  16. End Select
Jan 26 '09 #2

Expert Mod 15k+
P: 31,489
Radio Buttons don't work like that (See Don's post). It sounds like you actually need a CheckBox control instead.

In short, Radio Buttons allow you to select (only) one item from a group. CheckBoxes allow you to set True or False (Yes / No).

Bearing in mind the value of a standard CheckBox is either True or False, and that the .Locked property of a control is also either True or False, you can simply set the .Locked property to the value of the CheckBox any time that control is changed.
Expand|Select|Wrap|Line Numbers
  1. Me.[Variable Name].Locked = Me.[Letter Variables]
  2. Me.[Variable Type].Locked = Me.[Letter Variables]
  3. ...
Jan 27 '09 #3

Post your reply

Sign in to post your reply or Sign up for a free account.