How To check if object variable is initialized with valu

  • Thread starter Thread starter Serguei Makacharipov
  • Start date Start date
S

Serguei Makacharipov

dim frmSeekFor as Form
dim frm as form

for each frm in application.forms
if ucase(frm.name) = UCase("IamlookingForYou") then
set frmSeekFor = frm
end if
next frm

How to check if my variable is not equal to nothing?
if frmSekFor = Nothing then
doesn't work
 
If frmSeekFor Is Nothing then ... ' not found!

If Not (frmSeekFor Is Nothing) then ... ' found.

HTH,
TC
 
If Not frmSekFor Is Nothing Then
' code for when it is not nothing
Else
' code for when it is nothing
End If
 
Thank you very much.
Something clinched my brains.
Indeed frmSeekFor is Nothing
id more natural than
frmSeekFor = Nothing
 
Back
Top