 |
| Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

August 22nd, 2006, 12:02 PM
|
|
Authorized User
|
|
Join Date: Jan 2005
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
grouping yes/no fields
I'm in the process of setting up a form, and I have 4 yes/no fields that need to be in it. I want to group the fields so that only one of the yes/no fields will be able to be selected. The fields are: Pass, Fail, N/A, and obsolete.
I tried setting up an option group, but I can't seem to get the information to filter back to the table that is capturing the data.
Any help?
|
|

August 22nd, 2006, 12:53 PM
|
|
Friend of Wrox
|
|
Join Date: Dec 2005
Posts: 142
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
You might be better off using a ListBox.
|
|

August 23rd, 2006, 10:44 AM
|
|
Friend of Wrox
|
|
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
|
|
If you want to use the option group, you need all the boxes to refer back to one field in the table. The option group will return numbers, and each number represents the option:
Pass = 1
Fail = 2
N/A = 3
Obsolete = 4
In subsequent reports, you can use Select Case to substitute the values:
Select Case Status
Case 1
sVariableName = "Pass"
Case 2
sVariableName = "Fail"
...
End Select
Me.Text1 = sVariableName
Anywho, is that not what you want? Do you want the option group to pass text? I think it can do this. If not, just create an after update event for the status field (so I am calling it) to push a text value into a txtStatus field in the table.
Does this help?
mmcdonal
|
|

August 23rd, 2006, 12:43 PM
|
|
Authorized User
|
|
Join Date: Jan 2005
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
It helps quite a bit. Thanks! I'm new to option groups and managed to get one set up yesterday afternoon, but I do need the text for the values, to pull reports.
Thanks!
|
|

August 24th, 2006, 10:24 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
|
|
Yes, MMcDonal is correct. Instead of four yes/no fields, you simply need one field of type number (byte) that will hold 1 through 4. The option group will work with that field.
Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
|
|

August 24th, 2006, 11:10 AM
|
|
Friend of Wrox
|
|
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
|
|
When you pull a report, you can sort by the option numbers, and replace the number values with text values at runtime.
mmcdonal
|
|

August 24th, 2006, 11:15 AM
|
|
Authorized User
|
|
Join Date: Jan 2005
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks again for the help! This is not my database, I'm just working on a portion of it.
|
|
 |