How to change Option Group value (from # to text)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Student1000
    New Member
    • Jul 2007
    • 6

    How to change Option Group value (from # to text)

    Help me out please...

    Ok, i have been trying to do this for months….I kinda gave up on it but am back at it again.

    I created a form for a table (Bills). In the form, I have three option buttons (Yes,Tbd,No). The problem is that the value of these options are numbers (1,2,3). Therefore, every time I add a record using the form I end up with numbers on the column (A_Approved). So basically now I have to go to the table & change the numbers into (yes,tbd,no) manually!! It Sucks. Cause I know there has to be some kind of way.

    Some one told me that I should use 'Select Case' and the following is what I came up with (totally not working), U can ignore if it doesn’t make sense.


    Private Sub Frame38_AfterUp date()
    dim xy as integer
    dim ab as string (i wanted to define this as text but i dont know how)

    xy=frame38.valu e

    Select Case Me!Frame38
    Case 1:
    xy="YES"
    Case 2:
    xy="TBD"
    ............

    End Select


    Thank u very much for reading.
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    Originally posted by Student1000
    Help me out please...

    Ok, i have been trying to do this for months….I kinda gave up on it but am back at it again.

    I created a form for a table (Bills). In the form, I have three option buttons (Yes,Tbd,No). The problem is that the value of these options are numbers (1,2,3). Therefore, every time I add a record using the form I end up with numbers on the column (A_Approved). So basically now I have to go to the table & change the numbers into (yes,tbd,no) manually!! It Sucks. Cause I know there has to be some kind of way.

    Some one told me that I should use 'Select Case' and the following is what I came up with (totally not working), U can ignore if it doesn’t make sense.


    Private Sub Frame38_AfterUp date()
    dim xy as integer
    dim ab as string (i wanted to define this as text but i dont know how)

    xy=frame38.valu e

    Select Case Me!Frame38
    Case 1:
    xy="YES"
    Case 2:
    xy="TBD"
    ............

    End Select


    Thank u very much for reading.
    1. Make sure your Option Group is Unbound.
    2. Create a Text Box on your Form and Name it txtValues.
    3. Set the Control Source of this Field to the Field in the underlying Table that will store the values of YES, TBD, and NO.
    4. Set the Visible Property of txtValues to No.
    5. Copy and Paste the following code to the AfterUpdate() Event of the Option Group Frame.
      [CODE=vb]Private Sub Frame38_AfterUp date()
      Select Case Me![Frame38]
      Case 1
      Me![txtValues] = "YES"
      Case 2
      Me![txtValues] = "TBD"
      Case 3
      Me![txtValues] = "NO"
      End Select
      End Sub[/CODE]
    6. When you click on an Option in the Frame, the appropriate Text will be written to txtValues and stored in the Database as Text.
    7. This process will be completely Transparent to the User, since the Text Box is invisible.
    8. Let me know how you make out.

    Comment

    • Student1000
      New Member
      • Jul 2007
      • 6

      #3
      Thanks ADezii, that works very well. I followed exactly what u said "It works!!"

      Thanks again.

      Comment

      • ADezii
        Recognized Expert Expert
        • Apr 2006
        • 8834

        #4
        Originally posted by Student1000
        Thanks ADezii, that works very well. I followed exactly what u said "It works!!"

        Thanks again.
        You are quite welcome.

        Comment

        • DanicaDear
          Contributor
          • Sep 2009
          • 269

          #5
          This worked for me too. Thank you ADezii!

          Comment

          • ADezii
            Recognized Expert Expert
            • Apr 2006
            • 8834

            #6
            You are quite welcome, DanicaDear.
            Last edited by zmbd; Mar 28 '14, 06:48 PM. Reason: (^_^)

            Comment

            Working...