Hello, how do I set the field on a query to represent the actual name of a selection from an option button opposed to the query returing value 1, 2 etc?
Many thanks Darren.
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Option Values in Qeries (2000)
I’m assuming you mean that you want to return the label caption property that corresponds with the option button selected?
If so, there are at least a couple of options for you… Depending on how many option buttons are in the group…
You could use an IIF statement and nest the results… For example:
fldChoice: IIf([Forms]![frmName].[optGroupName]=1,[Forms]![frmName].[lblOneName].[Caption],IIf([Forms]![frmName].[optGroupName]=2, [Forms]![frmName].[lblTwoName].[Caption], [Forms]![frmName].[lblOneName].[Caption])
Or you could try something like the Choose function…
=Choose([Forms]![frmName].[optGroupName], [Forms]![frmName].[lblOneName].[Caption], [Forms]![frmName].[lblTwoName].[Caption],[Forms]![frmName].[lblThreeName].[Caption])
(of course, you’ll have to change the names I’ve used to your own… )
The Choose looks cleaner… but I haven’t tested it… Give both a try…
HTH…
I’m assuming you mean that you want to return the label caption property that corresponds with the option button selected?
If so, there are at least a couple of options for you… Depending on how many option buttons are in the group…
You could use an IIF statement and nest the results… For example:
fldChoice: IIf([Forms]![frmName].[optGroupName]=1,[Forms]![frmName].[lblOneName].[Caption],IIf([Forms]![frmName].[optGroupName]=2, [Forms]![frmName].[lblTwoName].[Caption], [Forms]![frmName].[lblOneName].[Caption])
Or you could try something like the Choose function…
=Choose([Forms]![frmName].[optGroupName], [Forms]![frmName].[lblOneName].[Caption], [Forms]![frmName].[lblTwoName].[Caption],[Forms]![frmName].[lblThreeName].[Caption])
(of course, you’ll have to change the names I’ve used to your own… )
The Choose looks cleaner… but I haven’t tested it… Give both a try…
HTH…
Another option, in addition to the suggestions from Trudi, would be to create a simple two field table with the values that correspond to the results of the option button, join to the table, and display the text that corresponds to the option choosen – you would use the value of the option group as a criteria in the query.
Another option, in addition to the suggestions from Trudi, would be to create a simple two field table with the values that correspond to the results of the option button, join to the table, and display the text that corresponds to the option choosen – you would use the value of the option group as a criteria in the query.
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.
Notifications