G
Guest
Hi TWIMC
I have a query that is the record source of form. On the Form_Current event I set a recordset to Me.RecordSetClone see the following code. I've removed/commented out the rest of the code but problem still exists. Now the problem is for unknown reason if I close the Access session it re - opens and the only way to close the Access sesson is to use End Task
I've wittled it down to the code line Set rstMyRecords = Me.RecordsetClone in that if I comment this line and only declare the recordset and then set it to nothing everything is OK, so what is wrong with the line of code. I have other forms that do exactly the same. The only difference being the the record source for the other forms is normally just one table but for this form there are 4 tables and criteria which uses user defind functions not sure if this effects a recordset. Any ideas on why the Access session doesn't close would be much appriciated. I think something related to the recordset is obviously staying active and is not be released when either rstMyRecords.Closs or Set rstMyRecords = Nothing are being used
Private Sub Form_Current(
On Error GoTo Form_Current_Er
Dim rstMyRecords As DAO.Recordse
Set rstMyRecords = Me.RecordsetClon
Form_Current_Exit
On Error Resume Nex
rstMyRecords.Clos
Set rstMyRecords = Nothin
Exit Su
Form_Current_Err
MsgBox Err & ": " & Error$, vbCritical, "Form_frmAddEditData.Form_Current
Resume Form_Current_Exi
Resume Nex
Resum
End Su
OK I found that it relates to my user defind functions so can someone tell me what is wrong with the following piece of code or identify which object remains open that forces the Access session not to close
Thanks again
KM
I have a query that is the record source of form. On the Form_Current event I set a recordset to Me.RecordSetClone see the following code. I've removed/commented out the rest of the code but problem still exists. Now the problem is for unknown reason if I close the Access session it re - opens and the only way to close the Access sesson is to use End Task
I've wittled it down to the code line Set rstMyRecords = Me.RecordsetClone in that if I comment this line and only declare the recordset and then set it to nothing everything is OK, so what is wrong with the line of code. I have other forms that do exactly the same. The only difference being the the record source for the other forms is normally just one table but for this form there are 4 tables and criteria which uses user defind functions not sure if this effects a recordset. Any ideas on why the Access session doesn't close would be much appriciated. I think something related to the recordset is obviously staying active and is not be released when either rstMyRecords.Closs or Set rstMyRecords = Nothing are being used
Private Sub Form_Current(
On Error GoTo Form_Current_Er
Dim rstMyRecords As DAO.Recordse
Set rstMyRecords = Me.RecordsetClon
Form_Current_Exit
On Error Resume Nex
rstMyRecords.Clos
Set rstMyRecords = Nothin
Exit Su
Form_Current_Err
MsgBox Err & ": " & Error$, vbCritical, "Form_frmAddEditData.Form_Current
Resume Form_Current_Exi
Resume Nex
Resum
End Su
OK I found that it relates to my user defind functions so can someone tell me what is wrong with the following piece of code or identify which object remains open that forces the Access session not to close
Thanks again
KM