View Full Version : Option Group


Misssie
02-27-2001, 05:52 AM
In a form that I am building, I am including an option group. My question is, how can I program it to de-select the option group once it is clicked & have it go back to being blank?
(Sounds like an easy thing to do, but I'm pretty new at this!)

I am using MS Access 97. Thanks

pdx_man
02-27-2001, 08:33 AM
Set the value of the option group to Null after it is clicked.

Misssie
02-27-2001, 09:28 AM
Thanks for the tip...but I think I worded my question wrong...so let me give you a little more detail on what I'm trying to do...

I want 3 separate options/check boxes: yes, no, & n/a. I want the value of yes & n/a to be 15, and no to be 0. Since I can't have 2 options in a group with the same value, I made 3 separate option groups and I want to be able to select a checkbox, or de-select the checkbox as needed in the form. I tried using just regular checkboxes without them being included in an option group, but I couldn't figure out how to assign a value to them. Am I going about this the wrong way? Any assistance will be greatly appreciated. Thanks!

pdx_man
02-27-2001, 09:46 AM
Ah,
Are you using VBA?
Check out the Tag property. It allows you to have additional data associated with a control. You retrieve it with:

MyVariable = me.checkbox22.tag

Misssie
02-28-2001, 10:36 AM
[Just as an FYI...(and I'm sure that if you haven't figured this out already, you probably will when you read my question) I have had no formal training on Access AT ALL! http://www.access-programmers.co.uk/ubb/smile.gif ]

OK...I can't figure out how to use the tag property (and the visual basic thing had me confused from day 1!) So...I think I figured this might be a simpler way to do this, and I wanted to get your opinion...

Instead of having 3 option groups, I have 2 regular check boxes for the yes & no, and 1 option group for no.

I made the Option Value of the "No" checkbox to -15, and included a radio button to click on with an option value of 0 to de-select the "No" box.

In the box I want to use to add up the scores, I included an event procedure (on click) that will start with 100 pts, and every time the no box is checked, will subtract the appropriate amount of points (as opposed to adding up all the yes boxes.)

Now...the problem I am having with this theory is that the event procedure is failing to add up the No check boxes correctly (every time I click on the checkbox, instead of subtracting 15, it only subtracts 1)...here is the code I am using in the event procedure. A "No" checkbox & radio button are included in Frames 648 & 654:

Me![Score] = Me![Frame648] + Me![Frame654]

Feel free to tell me if I'm doing this in a stupid manner!! http://www.access-programmers.co.uk/ubb/smile.gif
Thanks!

Jack Cowley
02-28-2001, 11:29 AM
Let me have a stab at this.... If you use an Option Group with three check boxes it will return either 1, 2 or 3. If you us a Select Case statment then you can get your 15 or 0 in this manner:

Select Case YourFrameName

Case 1 'Yes
Me![Score] = Me![Score] -15
Case 2 'No
Me![Score] = 0
Case 3 'n/a
Me![Score] = Me![Score] +15
End Select

Now I have made up the Me![Score] bit as you can see, but I hope this gives you an idea about how you might solve your problem. If you have questions about this approach you can email me directly.

One other thing, if you set the Frames Default Value to 0 it will always show all the options as unchecked when you move to a new record or you can reset it with code.

[This message has been edited by Jack Cowley (edited 02-28-2001).]

pdx_man
03-02-2001, 11:17 AM
Can you just count the 'NOs' and multiply by 15? Same with others?

Misssie
03-02-2001, 12:00 PM
That was another one of the things I couldn't figure out how to do....sounds like a much simplier idea. Can you tell me how I would do that? Also, the code I would put in the event procedure?

pdx_man
03-02-2001, 01:18 PM
Check out the DCount function. Use the same criteria, if any, as your form and add the criteria for the No value.