check if object set

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there something more elegant than this to determine if an object is set?
frm is a form object:

If Not frm is Nothing Then
....

TIA
 
Sorry, but this is the function isloaded

public function IsLoaded(FormName as String) As Boolean
dim strFName as String ' convert to lcase
dim frm as Form ' iterate forms collection

' ignore case
strFName = LCase$(FormName)

' assume it's not there
IsLoaded = False

' look through open forms
For Each frm in Forms
' could use StrComp if you prefer
If LCase$(frm.Name) = strTemp
' found it
IsLoaded = True
' don't bother going round any more
Exit For

End If
Next frm
End Function
 
Thanks Ofer! But what I am looking for is how to determine whether a variable
such as a form, recordset, etc. has been set.
 
What is your objection to ...

If Not frm Is Nothing Then

?

I am not aware of any alternative that would not be much less elegant than
this.
 
Back
Top