473,386 Members | 1,721 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Radio button/Option group queries

Hi. I work for a small consumer PC repair company as a workshop technician, but have recently been tossed into the deep end on coding an Access/VBA system for a client despite not having used VB since a school project nearly a decade ago. I am using Access 2013.

I am currently struggling with disabling and enabling a set of three text boxes (txtYears, txtMonths, txtDays) depending on the status of a radio button option group containing buttons optD & optI, with D enabling the text boxes and I disabling. There is no default value and I would ideally want the textboxes disabled until an option is selected.

I have a had a look at a couple of similar questions
(Here & here), but have been so far unable to successfully adapt the solutions provided for those circumstances to my own.

I also ideally need to make one of the forms combo boxes selection options vary based upon the same pair of radio buttons: the SQL query for the combo box's options needs to be "Where Team = '1'" if optD is selected and "Where Team = '2'" if optI is selected). Is this feasible?

Any help would be much appreciated.
Oct 8 '13 #1
2 4640
NeoPa
32,556 Expert Mod 16PB
An Option Group has a value which reflects which of its Radio Buttons is selected. Each Radio Button has a value and, when selected, that value is reflected by the Option Group. It also has an AfterUpdate event, whose event procedure you will want to utilise to change the 'Enabled' status of your various TextBoxes.

The default 'Enabled' status of your TextBoxes is set in the design. If they are enabled in the design then they will start out as enabled when you open the form until someone does something to change that.
Oct 8 '13 #2
ADezii
8,834 Expert 8TB
Adding to what NeoPa has already stated, assuming your Option Group is named fraChoices and the Default Option Values for OptD and OptI remain at 1 and 2 consecutively, the Enabling of these Text Boxes can be controlled as follows:
Expand|Select|Wrap|Line Numbers
  1. Private Sub fraChoices_AfterUpdate()
  2. With Me
  3.   ![txtYears].Enabled = (![fraChoices].Value = 1)
  4.   ![txtMonths].Enabled = (![fraChoices].Value = 1)
  5.   ![txtDays].Enabled = (![fraChoices].Value = 1)
  6. End With
  7. End Sub
Oct 8 '13 #3

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

Similar topics

2
by: Mokoena | last post by:
How do I get radio buttons to work in HTML, so that only one in a group can be selected at a time? How do I get the value returned from them? How do I reference them in JavaScript? What value is...
1
by: Rick | last post by:
After being frustrated with this issue on several occasions I think I found the secret sauce for solving the issue after reading a few different messages about what others thought and trying a...
1
by: Rage Matrix | last post by:
Hi all, I have a small problem with Access radio button groups in VBA. I've got a radio button group called fraSearchMode with three radio buttons in it. At a certain point, I want to see which...
1
by: Helen Trim | last post by:
Is there a group box property that tells you which radio button was clicked? -- Helen
2
by: NishSF | last post by:
Would anyone have any suggestions/javascript code so that if one clicks the Radio Button "Yes" below he has the option of selecting any of the six CheckBox below. If the user clicks on Radio Button...
3
by: Milsnips | last post by:
hi there, i have a repeater which returns me a list of addresses in each repeaterItem row. at the end of each row i have a radiobutton, which i want the user to select the "active" address. ...
6
by: ladybug76 | last post by:
Hello. Okay, so I have an Option Group with 6 reports on the Right hand side of a form. On the left, I have 4 command buttons. 1) Preview 2) Print 3) Save off 4) Email. I want the user to be...
1
by: akshay01 | last post by:
Hi all, I am using the following code to create the radio button group in which i have a while loop which will create the radio buttons with same name and different values. while(rs.next()){...
5
by: Dan Boyce | last post by:
Hi Everyone. It may be simple, I dunno... I never had to do this before and for the life of me I can't find anything on the net so far. I have a radio button group (which I'll post after this...
1
by: Frederik Silver | last post by:
Hi, i'am not so good in php, but i have a script with 2 radio options and i want to make it 3 this are the radio options below third one i made myself the problem is in the php what do i have...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.