Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Keep Option Group Value 2

Status
Not open for further replies.

MeldrethMan

Technical User
Feb 3, 2012
69
GB

I'm using an option group to set the value of a text field on a form.

Select Case Me.ogHomeType
Case 1
Me.HomeType = "IL"
Case 2
Me.HomeType = "F1"
Case 3
Me.HomeType = "SH"
Case 4
Me.HomeType = "RH"
End Select

When reopening the form all the option radio buttons are blank, which is confusing for users. If HomeType has value SH for example, I'd like radio button 3 to show up as selected.
 
You may try this in the Current event procedure of the form:
Code:
    Select Case Me.HomeType
    Case "IL"
    Me.ogHomeType = 1
    Case "F1"
    Me.ogHomeType = 2
    Case "SH"
    Me.ogHomeType = 3
    Case "RH"
    Me.ogHomeType = 4
    End Select

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I would store the number rather than the text in the field so that you could bind the option group to the field. Your kludge workaround is to set the value of ogHome in the On Current event of the form. The code would be the opposite of your Select Case statement
Code:
   Select Case M.HomeType
    Case "IL"
        Me.ogHome = 1
    Case "F1"
        Me.ogHome = 2
    Case "SH"
        Me.ogHome = 3
    Case "RH"
        Me.ogHome = 4
   End Select

Duane
Hook'D on Access
MS Access MVP
 
Great, thanks chaps, that works just fine. Much appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top