Radio Button Does Not Show Selection After Form is Closed

legalhustler

Well-known Member
Joined
Jun 5, 2014
Messages
1,171
Office Version
  1. 365
Platform
  1. Windows
I have a form with 4 different option groups and contains radio buttons (Yes, No, TBD). I select the values for a record, save it, close the form and reopen the record, but my selection does not show on the form. However, it is showing in the source Table. How can I fix this?

Most of the option groups has a macro associated to it. I'm not sure, but do I need to modify the macro to visibile or something? When I select a radio button and save the form it should save my selection whenever I open the record. Below is an example for one of the radio button option group.

Code:
Private Sub Frame103_AfterUpdate()
Select Case Me![Frame103]
    
        Case 1
            Me![Text101] = "Y"
            Me.Frame112.Locked = False
                       
        Case 2
            Me![Text101] = "N"
            Me.Frame112 = 2
            Me.Frame112.Locked = True
            
        Case 3
            Me![Text101] = "TBD"
            Me.Frame112 = 3
            Me.Frame112.Locked = True
    
    End Select
        
End Sub
 
Last edited:
Hmm, good question but you said you can't bind it to a Text field, so I thought perhaps that was because it was in a Group. Have not checked the theory myself.

Correct - the option group frame is not binded aka no Control Source. Take a look at the link I provided in my Post #5. I followed those instructions. I believe my code needs to be modified even though it shows the correct value I selected for Frame103 in my Table but not for Frame112. Frame112 always shows a "Y" in the Table even if I select "No" in my Form. In addition, my selection is invisible after I close the Form. I need my selection shown for the radio buttons for each record.
 
Last edited:
Upvote 0

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
I finally figured it! This is what my code is supposed to look like in order to get the correct values to show on my Table (since my Frames are not bounded) :

Code:
Private Sub Frame103_AfterUpdate()
    
    Select Case Me![Frame103]
        Case 1
            Me![Text101] = "Y"
            Me.Frame112.Locked = False
        
        Case 2
            Me![Text101] = "N"
            Me.Frame112 = 2
            Me.Frame112.Locked = True
            Me![Text313] = "N"
        Case 3
            Me![Text101] = "TBD"
            Me.Frame112 = 3
            Me.Frame112.Locked = True
            Me![Text313] = "TBD"
                                
End Select
End Sub

Private Sub Frame112_AfterUpdate()
Select Case Me![Frame112]
    Case 1
        Me![Text313] = "Y"
    Case 2
        Me![Text313] = "N"
    Case 3
        Me![Text313] = "TBD"
End Select
End Sub

The 2nd issue is still there - whenever I make my selection for the radio button it should display when I close and re-open the Form. Should I have a After_Update event for the Form so that once a radio button selection has been made to a record and is closed, then the values shows when I re-open it? How can I fix this?
 
Last edited:
Upvote 0
We could be having a terminology difference here. The Select Case statement would not be a Macro, it would code behind the After_Update event of the Frame. If you followed those instructions then that would be code, as in what you posted is Code. I thought you had a Macro in addition to the Code you posted. So, now that we have that straightened out here's the problem...

The Select Case is numeric unbound because you are storing text, they don't match so the Option Group can' show the value. could try putting some Code in the On_Current event of the Form, something like...

Code:
Select Case Me![Frame103]

Case 1
Me![Frame103] = 1

Case 2
Me![Frame103] = 2

Case 3
Me![Frame103] = 3

End Select

I stumbled upon someone with a similar issue, but I can't seem to incorporate the Current event for my Form with my code (see previous post). If you can help that would be great.

How to make text entry into table based on radio button selection in forms in Access 2010 - Stack Overflow
 
Upvote 0
Hi,
It's just like in the thread at stackoverflow. In your on current event code, you set the value of the (unbound) frame based on the value of the (bound) textbox,

i.e. something like

Code:
Private Sub Form_Current()

    Select Case Me.text103
    Case "Y"
       Me.Frame103 = 1
    Case "N"
       Me.Frame103 = 2
    Case "TBD"
       Me.Frame103 = 3
    End Select

    Select Case Me.text313
    Case "Y"
       Me.Frame112 = 1
    Case "N"
       Me.Frame112 = 2
    Case "TBD"
       Me.Frame112 = 3
    End Select

End Sub
 
Upvote 0
Hi,
It's just like in the thread at stackoverflow. In your on current event code, you set the value of the (unbound) frame based on the value of the (bound) textbox,

i.e. something like

Code:
Private Sub Form_Current()

    Select Case Me.text103
    Case "Y"
       Me.Frame103 = 1
    Case "N"
       Me.Frame103 = 2
    Case "TBD"
       Me.Frame103 = 3
    End Select

    Select Case Me.text313
    Case "Y"
       Me.Frame112 = 1
    Case "N"
       Me.Frame112 = 2
    Case "TBD"
       Me.Frame112 = 3
    End Select

End Sub

I didn't know you could put the two different Select cases under one Current event, I thought they had to be separated. You accidently put Text103 instead of Text101. This is working beautifully. Thank you again for the rescue!
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,034
Messages
6,122,782
Members
449,095
Latest member
m_smith_solihull

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top