I have some code where I am looping through checkboxes on a form where each checkbox name represents a field name from another form. If the checkbox is checked, the code is designed to hide that field in the other form. This works fine if I state the name of the control explicitly. But when I loop through each checkbox is designated as the current "ctl" or "ctl.name", I get a syntax error. I think this is perhaps because the ctl it is supposed to hide is in another form. Is there any way to get around this? Thanks!
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.ControlType = acCheckBox Then
If ctl.Value = True Then
Forms!SKUWorkOrder_SubformWODetails.Form.ctl.Name.ColumnHidden = True
End If
End If
Next ctl