Home  |   French  |   About  |   Search  | mvps.org  

What's New
Table Of Contents
Credits
Netiquette
10 Commandments 
Bugs
Tables
Queries
Forms
Reports
Modules
APIs
Strings
Date/Time
General
Downloads
Resources
Search
Feedback
mvps.org

In Memoriam

Terms of Use


VB Petition

Forms: Return Strings from Option Groups

Author(s)
Dev Ashish

(Q) I'm using an Option Group on my form but I don't like the fact that it will only store numbers. How can I have the Option Group store strings?

(A) Option groups cannot store string values. You're limited to using numbers with them. However, with the use of a simple Select Case statement, you can control what's shown to the user.

For example, suppose you have an Option Group "ctlOption" which has 3 options with in it. Using the AfterUpdate event of the option group, you can assign strings to different controls.

'****** Code Start ******
Sub ctlOption_AfterUpdate()      Select Case me!ctlOption          Case 1:              Msgbox "One was Selected"          Case 2:              Msgbox "Two was selected"
         Case 3:              Msgbox "Three was selected"
     End Select End sub
 '****** Code end ******

© 1998-2010, Dev Ashish & Arvin Meyer, All rights reserved. Optimized for Microsoft Internet Explorer