Option buttons (2) to control Combo box

evega6686

Registered User.
Local time
Today, 14:19
Joined
Jun 2, 2015
Messages
50
I have 2 Option buttons that I want to use to control a combo box. If I select Option1 then I want it to pull from one table for the drop-down choices. If I select Option2 I want it to pull from a different table. The Option buttons and combo box are all on the same form.

Thanks in advance for any assistance.
 
Sorry,...the code you supplied is not making the switch for me. It allows me to select Option1, and I get the values in the drop-dosn combo box. When I select Option2 Option one stays selected. If I try to switch to Option1 then the values for Option2 remain in the drop-down combo.

here is the code you supplied:

Option Compare Database
Option Explicit
Private Const SQL_CCODE As String = "SELECT CCode FROM CCode ORDER BY CCode;"
Private Const SQL_CCAH As String = "SELECT [Year_Month] FROM CCAH;"
______________________________________
Private Sub Combo142_AfterUpdate()
Me.lstLastCID.Requery
End Sub
_______________________________________
Private Sub PGCode_AfterUpdate()
Me.lstLastCID.Requery
End Sub
_____________________________________________
Private Sub PDCode_AfterUpdate()
Me.lstLastCD.Requery
End Sub
____________________________________________
Private Sub fraFrame201_Click()
With Me.Combo142
Select Case fraFrame201.Value
Case 1
.RowSource = SQL_CCODE
Case 2
.RowSource = SQL_CCAH
End Select
Me.Requery
End With

End Sub
 
If you had problems, you could have posted in the same thread. We can see all threads.

This is the code you were given:
Code:
Private Sub fraAutoCcah_Click()
    With Me.cboCCode
        Select Case fraAutoCcah.Value
            Case 1
                .RowSource = SQL_CCODE
            Case 2
                .RowSource = SQL_CCAH
        End Select
        .Requery
    End With
    
    Me.lstLastInSeries.Requery
End Sub
Can you spot the differences?
 
[SOLVED] Option buttons (2) to control Combo box

Yes I do.

Thanks so much for clearing this up...I owe you a beer (pint)!:D
 

Users who are viewing this thread

Back
Top Bottom