![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Microsoft Office support MS Office support forum |
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) |
|
Registered User
Join Date: Jan 2008
Posts: 17
OS: xp
|
Using Option Groups in Access to Select Report Records
I am using Access 2003. I used the wizard to set up an option group that has three items; Check1, Check2 and Check3. Check1 has an option value of 1, Check2 = 2, Check3 = 3. I am having a hard time reading the state of those check items within a query to select records; i.e. when Check1 is in focus I should retrieve records with a type = 1, when Check2 is in focus I should retrieve records with a type = 2; all records when Check3 is in focus. What good is the "option value"? And, how do I read which item has been checked when the query is run? I cannot find any on-line help with examples of code that would help me out.
|
|
|
|
| Important Information |
|
Join the #1 Tech Support Forum Today - It's Totally Free!
TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free. Join TechSupportforum.com Today - Click Here |
|
|
#2 (permalink) |
|
Tech, Microsoft Support
Join Date: Dec 2008
Location: Chicagoland
Posts: 1,193
OS: Windows XP SP3
|
Re: Using Option Groups in Access to Select Report Records
You should be able say myform.myoptiongroup.value in the criteria row of your corresponding column in the query and that should pick up the value of the option group, compare it against the value of that field and either include it in the report or exclude it.
__________________
Balaji Ramanathan Computers - You can't live with them, you can't live without them!
|
|
|
|
|
|
#3 (permalink) |
|
Registered User
Join Date: Jan 2008
Posts: 17
OS: xp
|
Re: Using Option Groups in Access to Select Report Records
The optionGroup's name appears to be Frame93 (as built through the wizard). I proved that was the optionGroup name by changing the default selection's value and the Default Value of Frame93 also changed. Now, I inserted Frame93 into my query just to see what value would show up (not including it in the selection criteria) and all I get is a small box on each record - no value at all. If I use Frame93 in the selection criteria I get nothing because the controls value is not numeric (the box is?). Any more help on this?
|
|
|
|
|
|
#4 (permalink) |
|
Tech, Microsoft Support
Join Date: Dec 2008
Location: Chicagoland
Posts: 1,193
OS: Windows XP SP3
|
Re: Using Option Groups in Access to Select Report Records
My mistake. It should be myform.mycontrol.optionvalue, not just value. This is what Access VBA help says about the optionvalue property. Hope you find it helpful:
------------------------------------------ OptionValue Property See AlsoApplies ToExampleSpecificsEach control in an option group has a numeric value that you can set with the OptionValue property. Read/write Long. expression.OptionValue expression Required. An expression that returns one of the objects in the Applies To list. Remarks When the control is selected, the number is assigned to the option group. If the option group is bound to a field, the value of the selected control's OptionValue property is stored in the field. For example, this Region option group is bound to the Region field in a table. The Europe button has an OptionValue property setting of 1, the Asia button has a setting of 2, and the Africa button has a setting of 3. When one of these buttons is selected, the Region option group value will be the same as the OptionValue property setting for the selected control. In this case, because the Region option group is bound to the Region field, the value of this field in the table also equals 2. Note The OptionValue property applies only to the check box, option button, and toggle button controls in an option group. You can set the OptionValue property by using the control's property sheet, a macro, or Visual Basic. Unless you change the OptionValue property yourself, the first control you place in an option group has a value of 1, the second control has a value of 2, and so on. The OptionValue property is only available when the control is placed inside an option group control. When a check box, a toggle button, or an option button isn't in an option group, the control has no OptionValue property. Instead, each such control has a ControlSource property, and the value of each control will be either True if selected or False if not selected. Example The following example sets the OptionValue property for three option buttons in the "Ship Method Group" option group when a form opens. When an option button is selected in the option group, a message displays indicating the shipper's assigned ID number. Private Sub Form_Open(Cancel As Integer) Me.Controls("ABC Couriers").OptionValue = 15876 Me.Controls("Speedy Delivery").OptionValue = 742 Me.Controls("Lightning Express").OptionValue = 1256 End Sub Private Sub Ship_Method_Group_Click() MsgBox "The ID for the selected shipper is " & Me.Controls("Ship Method Group").Value End Sub ----------------------------------------------------------
__________________
Balaji Ramanathan Computers - You can't live with them, you can't live without them!
|
|
|
|
![]() |
| Thread Tools | |
|
|