NeedsHelp101
Technical User
Hello,
I made an option group ToggleFrame with 4 buttons, and wrote code so that when a button was pressed, it would change the row source of a combo box Combo1.
The problem is, I think, that the combo box is on a subform (Sub_Form), while the option group is on the main form. I did it like this to save space (which I need), but am running into the error: Microsoft Access can't find the form 'Sub_Form' in a macro expression or Visual Basic code.'
Is there any way around putting the control and the cbo box on the same form?
Thanks!
I made an option group ToggleFrame with 4 buttons, and wrote code so that when a button was pressed, it would change the row source of a combo box Combo1.
The problem is, I think, that the combo box is on a subform (Sub_Form), while the option group is on the main form. I did it like this to save space (which I need), but am running into the error: Microsoft Access can't find the form 'Sub_Form' in a macro expression or Visual Basic code.'
Code:
Private Sub ToggleFrame_AfterUpdate()
Dim Combo1 As ComboBox
Set Combo1 = Forms!Sub_Form.Combo1
If ToggleFrame = 1 Then
Combo1.RowSource = "qryNotSpanTV"
End If
If ToggleFrame = 2 Then
Combo1.RowSource = "qryNotSpanRadio"
End If
If ToggleFrame = 3 Then
Combo1.RowSource = "qrySpanTV"
End If
If ToggleFrame = 4 Then
Combo1.RowSource = "qrySpanRadio"
End If
End Sub
Is there any way around putting the control and the cbo box on the same form?
Thanks!