I have a custom class I've created, and one of the properties is an ADODB.Recordset. Here's the code:
Private Property Let CharDistCurrFile(ByVal vData As ADODB.Recordset)
Set mCharDistCurrFile = vData
End Property
Private Property Get CharDistCurrFile() As ADODB.Recordset
Set CharDistCurrFile = mCharDistCurrFile
End Property
Standard stuff, right? Now in a sub I Dim a disconnected rs (so scope is only within that sub), create some records, and when I'm done I want to assign the disconnected rs to my CharDistCurrFile property, as in:
CharDistCurrFile = rs
At the end of that sub I destroy the rs with 'rs.Close' and 'Set rs = Nothing'.
Then later in another sub I want to use my CharDistCurrFile property...but it contains nothing! Apparently destroying the rs also empties out my property. How can I assign the entire contents of an rs to a property and have that data persist after I destroy the rs object???
Private Property Let CharDistCurrFile(ByVal vData As ADODB.Recordset)
Set mCharDistCurrFile = vData
End Property
Private Property Get CharDistCurrFile() As ADODB.Recordset
Set CharDistCurrFile = mCharDistCurrFile
End Property
Standard stuff, right? Now in a sub I Dim a disconnected rs (so scope is only within that sub), create some records, and when I'm done I want to assign the disconnected rs to my CharDistCurrFile property, as in:
CharDistCurrFile = rs
At the end of that sub I destroy the rs with 'rs.Close' and 'Set rs = Nothing'.
Then later in another sub I want to use my CharDistCurrFile property...but it contains nothing! Apparently destroying the rs also empties out my property. How can I assign the entire contents of an rs to a property and have that data persist after I destroy the rs object???