Good Morning and thank you in advance for any assistance provided -
I have a main form, lets call it FrmMain. In addition, I have a subform on FrmMain that has a tab control on it (frmSubform). What I would like to do is on form load, reference the tab control that is on the subform, loop through the controls/textboxes, lock them and change their backcolor. The code I am attempting is listed below, however, I am getting a "type mismatch error" highlighting this line:banghead::
Below is my code:
Thank you for any help.
I have a main form, lets call it FrmMain. In addition, I have a subform on FrmMain that has a tab control on it (frmSubform). What I would like to do is on form load, reference the tab control that is on the subform, loop through the controls/textboxes, lock them and change their backcolor. The code I am attempting is listed below, however, I am getting a "type mismatch error" highlighting this line:banghead::
PHP:
Set Frm = Forms!frmConsultingMain!FrmConsultingFeeData
Below is my code:
PHP:
Dim ctl As Control
Dim Frm As Form
Set Frm = Forms!frmmain!FrmSubform
For Each ctl In Frm.Controls
If (TypeName(ctl) = "Textbox" Or (TypeName(ctl) = "combobox") Or (TypeName(ctl) = "listbox")) Then
ctl.Value = Null
ctl.BackColor = vbYellow
ctl.Locked = True
End If
Next ctl
Thank you for any help.
Last edited by a moderator: