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
 

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

Back
Top