How To check if object variable is initialized with valu

  • Thread starter Serguei Makacharipov
  • 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
 
T

TC

If frmSeekFor Is Nothing then ... ' not found!

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

HTH,
TC
 
K

Ken Snell

If Not frmSekFor Is Nothing Then
' code for when it is not nothing
Else
' code for when it is nothing
End If
 
Top