Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is the object variable initialized?

Status
Not open for further replies.

Kimed

Programmer
May 25, 2005
104
LT
Hi,

In my application, I need a following construction:

Public Var as Object ' (at module level)
...
If <Var not set> Then Set Var = CreateObject("XXX")

But how to define the condition? For non-declared explicitly or declared as other type variables IsEmpty() shows True until the value is set, but somehow for the Object type variable it doesn't work, even though the variable itself is shown as "Nothing" in the debugger. (I also tried IsNull - it doesn't help either).

Thanks.
 
Have yiu tried this ?
If Var Is Nothing Then

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Aw, thanks. I've tried "If Var = Nothing" and it blasted. Didn't think about this one.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top