I'm used to seeing runtime error 91 ("Object variable or With block variable not set") when I try to say
instead of
however, the following code uses set, and the error only occurs when I try to exit the function:
the line Set getCtl = ctl is being properly executed, and when I try to exit the function getCtl is still properly set. Any ideas why I'm hitting this error? Thanks.
-Eric
Code:
var = object
Code:
set var = object
however, the following code uses set, and the error only occurs when I try to exit the function:
Code:
' Find a control for the given string name
Private Function getCtl(field As String, frm As Form) As Control
Dim ctl As Control
For Each ctl In frm
If ctl.Name = field Then
Set getCtl = ctl
Exit Function
End If
Next ctl
End Function
the line Set getCtl = ctl is being properly executed, and when I try to exit the function getCtl is still properly set. Any ideas why I'm hitting this error? Thanks.
-Eric