Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do you know if there is nothing in an object 2

Status
Not open for further replies.

vbnovice1

Programmer
May 1, 2006
9
GB
How do you know if there is something in an object

Dim rstObjct As Object

Set rstobjct = pvsomething

If rstobjct = Nothing Then

The if statement does not work. How do I do this?

Can anyone help?

Thanks
 
hey i think the problem is that
you didnot end the if statement ot give me more details
 
JustinEzekiel proposed the correct solution: You shouldn't use the = sign to check if an object exists. In an If statement, you basically use the = as a comparison operator, but if the object doesn't exist, there is nothing to compare with...

A somewhat more structured way to put it, could be:

Select Case rstObjct Is Nothing
Case True

Case False

End Select


_________________________________
In theory, there is no difference between theory and practice. In practice, there is. [attributed to Yogi Berra]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top