G
Guest
I am trying to use the following code on several forms where 1 or 2 comobos
will sometimes have a listcount of 1. When i call this sub with
call SizeList1(Me)
i get a message saying 'object doesn't support this property or method'.
Is there any way that i can do this with a public sub?
Public Sub SizeList1(frm As Form)
'On Error GoTo SubErr
Dim ctl As Control
Set ctl = Screen.ActiveControl
With ctl
If .ListCount = 1 Then
.ctl = .ctl.ItemData(0)
End If
End With
Set ctl = Nothing
will sometimes have a listcount of 1. When i call this sub with
call SizeList1(Me)
i get a message saying 'object doesn't support this property or method'.
Is there any way that i can do this with a public sub?
Public Sub SizeList1(frm As Form)
'On Error GoTo SubErr
Dim ctl As Control
Set ctl = Screen.ActiveControl
With ctl
If .ListCount = 1 Then
.ctl = .ctl.ItemData(0)
End If
End With
Set ctl = Nothing