VB6 - checking if a variable is set
I'm cleaning up some old Visual Basic 6 code at work and I've run into a problem of someone not checking if an ADO recordset is set (with new, or set) or not.
Being used to C++ I tried isNull, but that doesn't seem to work here in VB. Neither does isSet. I tried IsEmpty, var = Nothing, IsObject, but none tell me if the variable is set or not.
So, what function would I need to see if the object is set or not?
you should try to this one..
If var Is Nothing Then
// Var is not set.
Else
// Var is set.
End If
If var Is Nothing Then
// Var is not set.
Else
// Var is set.
End If
depending on what your recordset is called do this.
for example it will be rst.
if rst.EOF = true then
'no useable records
else
'some records here
end if
for example it will be rst.
if rst.EOF = true then
'no useable records
else
'some records here
end if
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement