Hello
VBA gurus!
I'm new to VBA and have the following problem:
I have a lookup-function which returns a reference to an object or the value
"Nothing" if no object was found. Then I need to compare the returned value
with another object. The comparison with "Nothing" should always result to
"false". But instead, I get an error message.
How can I compare two objects one of which is "Nothing"? I've found the
function IsNull but it seems not to do what I need.
Example:
function finder(arg as integer) as MyObject
if arg > 0 then
set finder = new MyObject
else
set finder = Nothing
end if
end function
function tester () as boolean
dim retVal as MyObject
set retVal = finder()
if retVal = Nothing then ' This is what doesn't work (runtime error)
' do something
else
' do something else
end if
end function
Thanks in advance.
--
Alexander
Sent via Deja.com http://www.*-*-*.com/
Before you buy.