Hi,
i have MainForm with 2 subforms like in attachment.
1) frmSourceSubform
2) frmSourceApplicationSubform
And now i want to run code like below (to show text "working!") when i will select "Linux" on frmSourceSubform. Problem is when frmSourceApplicationSubform is empty, i can not retrieve ctl.Recordset.Name.
If i add something,
To mirror error:
1. Go to frmMain
2. select record with "Linux" source
3. Click "Run macro" button.
you will see msgbox message (no combobox field).
Please help,
Best,
Jacek
i have MainForm with 2 subforms like in attachment.
1) frmSourceSubform
2) frmSourceApplicationSubform
And now i want to run code like below (to show text "working!") when i will select "Linux" on frmSourceSubform. Problem is when frmSourceApplicationSubform is empty, i can not retrieve ctl.Recordset.Name.
If i add something,
is working.Debug.Print ctl.Recordset.Name
Code:
Private Sub Command2_Click()
Dim frm As Access.Form
Dim frmSelected As Access.Form
Dim TableStr As String
sfrm = Me.Name
Set frm = Forms(sfrm).Controls("frmSourceApplicationSubform").Form
Dim ctl As Control
On Error GoTo ErrorHandler
For Each ctl In frm.Form.Controls
If ctl.ControlType = acComboBox Then
Debug.Print ctl.Recordset.Name
'frm.LstFieldsToAdd.RowSource = "tblWorkload"
[B]MsgBox "working!"[/B]
End If
Next ctl
Exit Sub
ErrorHandler:
MsgBox "There is no combobox field"
End Sub
To mirror error:
1. Go to frmMain
2. select record with "Linux" source
3. Click "Run macro" button.
you will see msgbox message (no combobox field).
Please help,
Best,
Jacek