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
 
S

Serguei Makacharipov

Thank you very much.
Something clinched my brains.
Indeed frmSeekFor is Nothing
id more natural than
frmSeekFor = Nothing
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top