Robert
robert at servicexp.com
Fri Mar 21 19:48:30 CDT 2008
John, Thank you... How do you find the cause of setting a class to nothing, and the Class_Terminate sub not running.. I'm assuming something is still open within the class, but just can't see it.. Set qbc = Nothing Does not cause the Class_Terminate() sub to run.. Thanks Again. WBR Robert -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Friday, March 21, 2008 7:12 PM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Closing & Destroying Objects You need to set pointers to nothing EVERYWHERE. You need to close before setting pointers to nothing in the last place that the recordset is used. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Robert Sent: Friday, March 21, 2008 6:09 PM To: 'Access Developers discussion and problem solving' Subject: [AccessD] Closing & Destroying Objects Hello Group, I have a question about how to close an object correctly.. Dim rstWOS As DAO.Recordset Set rstWOS = db.OpenRecordset("qryServicesNavigator", dbOpenDynaset, dbInconsistent) I do a findfirst on rstWOS which I pass to another form. Like such.. DoCmd.OpenForm "frmMsgboxWODelete", , , , , acHidden With Form_frmMsgboxWODelete .CallingForm = "Calander" .RN = EventRN Set .rst = rstWOS .Visible = True End With In the form it's a property Private m_objRst As DAO.Recordset Public Property Set rst(objRst As DAO.Recordset) Set m_objRst = objRst End Property Where do I Properly close and destroy the recordset, in the first or the second or both? I'm thinking that I need to destroy it on the first, as if I destroy it on second via: Private Sub Form_Unload(Cancel As Integer) If Not m_objRst Is Nothing Then m_objRst.Close Set m_objRst = Nothing End If End Sub Then I get some very strange problems trying to destroy in on the first.. Like and Error 3420 Oject Invalid or No Longer Set Via: (because the recordset is already closed??) If Not rstWOS Is Nothing Then rstWOS.Close Set rstWOS = Nothing End If TIA... WBR Robert -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com