-
Hi
I am creating a program that uses class modules to access a database. All the procudures that access the database are in a class module.
Whenever I am retrieving records from the database I am first checking to see if there are any by using..
if rs.eof = true and rs.bof = true then
exit sub
end if
..I want to maybe use a flag that is set in this class module when there are no records. How can I get my form to recognise this flag?
Any help would be appreciated
Thanks
-
You simply set up a private variable with the appropriate Let and Get procedures and then set it using the . operator
i.e., in the class (e.g. MyClass)
Code:
Private m_NoRecordsFlag As Boolean
Public Property Get NoRecordsFlag() As Boolean
NoRecordsFlag = m_NoRecordsFlag
End Property
Public Property Let NoRecordsFlag(ByVal bNewFlagValue As Boolean)
m_NoRecordsFlag = bNewFlagValue
End Property
And in your form you would have:
Code:
Dim o_MyClass As MyClass
Set o_MyClass = New MyClass
If rs.EOF = True and rs.BOF = True Then
o_MyClass.NoRecordsFlag = True
Exit Sub
Else
o_MyClass.NoRecordsFlag = False
End If
P.