473,467 Members | 1,402 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How do I get the dot to appear when an option button is selected?

5 New Member
Hi,

I'm new here and have a bit of a problem. I'm building a form in Access 2003 and have a piece of code I'm using to ensure that the correct values are saved in the table when each option is selected. This was the original code:
Expand|Select|Wrap|Line Numbers
  1. Private Sub AdministrativeSoundness_AfterUpdate() 
  2.     Select Case AdministrativeSoundness 
  3.         Case 1 
  4.             'Green 
  5.             Me.AdministrativeSoundness = "15" 
  6.         Case 2 
  7.             'Amber 
  8.             Me.AdministrativeSoundness = "7.5" 
  9.         Case 3 
  10.             'Red 
  11.             Me.AdministrativeSoundness = "0" 
  12.         Case Else 
  13.     End Select 
  14. End Sub 
For some reason when I use the above, the dot that shows the option button has been selected doesn't appear. So, based on a response to a question someone else had, I tried this:
Expand|Select|Wrap|Line Numbers
  1. Private Sub AdministrativeSoundness_AfterUpdate() 
  2.     Select Case AdministrativeSoundness 
  3.         Case 1 
  4.             'Green 
  5.             Me.AdministrativeSoundness = "15" 
  6.             Me.optASGreen.Visible = True 
  7.         Case 2 
  8.             'Amber 
  9.             Me.AdministrativeSoundness = "7.5" 
  10.             Me.Option961.Visible = True 
  11.         Case 3 
  12.             'Red 
  13.             Me.AdministrativeSoundness = "0" 
  14.             Me.Option963.Visible = True 
  15.         Case Else 
  16.     End Select 
  17. End Sub 
Unfortunately, I still don't get my little green dot, which I really need so that the users know they have answered that question. I have also tried separating the two actions by putting the 'visible =True' bit into an event procedure on the AdministrativeSoundness_Click event, but that didn't work either.

Can anyone tell me what I'm doing wrong? I know it's got something to do with the select case function, which I need in order to get the decimal value into the table, because it doesn't happen on the form tabs where I can just key the value I want directly into the option button's properties field. It only happens on the tabs where I need to use the select case statement.

I'm self-taught in Access, and until I started building this database, I'd managed to avoid VBA, so I'm not really sure that I'm going about this the right way.
Aug 31 '08 #1
3 2173
missinglinq
3,532 Recognized Expert Specialist
If AdministrativeSoundness is an Option Group, its value can only be an Integer, hence the Case 1, Case 2, etc. These Integer values are assigned by Access when the group is created, so yours would be

Green 1
Amber 2
Red 3

But you’re then immediately assigning different values to AdministrativeSoundness, and string values at that:

Green 15
Amber 7.5
Red 0

Since these values don’t have a corresponding option button in AdministrativeSoundness, no option button is selected, i.e. no button has a black dot showing.

Your choices here are

Have the Option Group be unbound, then assign your values of 15, 7.5 and 0 to AdministrativeSoundness.

or

Let Access store the values of 1, 2 and 3 in your table, and then “translate” these values, when needed, into the output you want ( 15, 7.5, 0) in an unbound textbox with a Select Case similar to what you already have, except you assign the output to the unbound textbox.

Expand|Select|Wrap|Line Numbers
  1. Private Sub AdministrativeSoundness_AfterUpdate() 
  2.     Select Case AdministrativeSoundness 
  3.         Case 1 
  4.             'Green 
  5.             Me.DisplayAS = "15" 
  6.         Case 2 
  7.             'Amber 
  8.             Me.DisplayAS = "7.5" 
  9.         Case 3 
  10.             'Red 
  11.             Me.DisplayAS = "0" 
  12.         Case Else 
  13.     End Select 
  14. End Sub 
where DisplayAS is the unbound textbox.

Welcome to Bytes!

Linq ;0)>
Aug 31 '08 #2
ladycyradis
5 New Member
Thanks so much. It's fixed now and a great relief. Thanks again.
Sep 1 '08 #3
missinglinq
3,532 Recognized Expert Specialist
Always happy to help a lady! Are you perhaps the ladycyradis from "down under?"

Linq ;0)>
Sep 1 '08 #4

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

Similar topics

1
by: ehm | last post by:
I apologize in advance for the cross-post (from microsoft.public.inetexplorer.scripting), but that board seems dead. I have what I think is a fairly simple problem, but I cannot figure this out....
1
by: middletree | last post by:
For an ASp Intranet app, I have some code that should work, but I am not able to make it happen for some reason, after spending considerable time on this. I am pretty thick when it comes to...
2
by: Mad Scientist Jr | last post by:
I'm trying to get javascipt select all items in a HTML form <SELECT> control and submit the form to an asp.net page. For some reason when the link is clicked, you can see the items all get...
8
by: McKirahan | last post by:
Firefox does not reflect selected option via innerHTML How do I get Firefox to reflect selected option values? <html> <head> <title>FFinner.htm</title> <script type="text/javascript">...
8
by: Galina | last post by:
Hello I have 6 dependent list boxes on my ASP page:  Faculty;  Lecturer;  Course;  Course occurrence;  Group;  Week commencing date. When faculty is selected, lists of lecturers and...
6
by: ducky | last post by:
I have set up two option buttons. When option button 1 is selected I need to make sure that the combo box located beside Option button 2 is cleared. In turn I need to make sure that if a value is...
4
by: coldfusionstudent | last post by:
i wish to show/appear and dissappear text box based on a the drop down item selected. what do i have to add? thanks under Comm_DEV drop down selection.
0
by: Nathan Sokalski | last post by:
I have a DropDownList in which I set the SelectedIndex property in my code. However, when I run a debug it does not appear selected (actually, none of the ListItems are even visible in the...
2
beacon
by: beacon | last post by:
Hi everybody, I have a form that has a combo box that asks the user to select the program they work on. Once the user selects the program, a SQL statement populates the row source for 4 staff...
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,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.