I am experiencing an error 458 "Variable uses an automation type not supported in Visual Basic" when opening a form. In the Form_Activate sub I call another sub setHOSfields() that enables/disables some check boxes on the form based upon the value of a related checkbox. This is where the error occurs but i cannot figure out why? Prior to calling this the arraysetup() has been initialized to contain a list of control names to check in this sub. If I move this call to the Form_Load() sub it doesn't error out but it also doesn't work because all of the controls are set to False anyway. Any ideas as to why this would fail?
Private Sub setHOSfields()
Dim ctl As Control
For i = 0 To UBound(arrsetup)
If Me.Controls(arrsetup(i) & "reqd") Then
Me.Controls(arrsetup(i) & "have").Enabled = True
Me.Controls(arrsetup(i) & "ordered").Enabled = True
Me.Controls(arrsetup(i) & "setup").Enabled = True
Else
Me.Controls(arrsetup(i) & "have").Enabled = False
Me.Controls(arrsetup(i) & "ordered").Enabled = False
Me.Controls(arrsetup(i) & "setup").Enabled = False
End If
Next i
End Sub
Private Sub setHOSfields()
Dim ctl As Control
For i = 0 To UBound(arrsetup)
If Me.Controls(arrsetup(i) & "reqd") Then
Me.Controls(arrsetup(i) & "have").Enabled = True
Me.Controls(arrsetup(i) & "ordered").Enabled = True
Me.Controls(arrsetup(i) & "setup").Enabled = True
Else
Me.Controls(arrsetup(i) & "have").Enabled = False
Me.Controls(arrsetup(i) & "ordered").Enabled = False
Me.Controls(arrsetup(i) & "setup").Enabled = False
End If
Next i
End Sub