
closing ADO data controls and data environment connections
I need to close two ADO data control connections and a data environment
connection so as to be able to back up the database they refer to.
My code for this is:
frmMain.datPrimaryRS.Recordset.Close
Set frmMain.datPrimaryRS.Recordset = Nothing
frmMain1.datPrimaryRS.Recordset.Close
Set frmMain1.datPrimaryRS.Recordset = Nothing
DataEnvironment1.Connection1.Close
Set DataEnvironment1 = Nothing
This does the job, but the lines
Set frmMain.datPrimaryRS.Recordset = Nothing and
Set frmMain1.datPrimaryRS.Recordset = Nothing
produce several OBDC error messages like: "Data source name not found and no
default driver specified."
But without a line like Set frmMain.datPrimaryRS.Recordset = Nothing I get a
permission denied on trying to save the database.
The line Set DataEnvironment1 = Nothing produces no error message.
What do I need to do to remove enough references to the two data controls
(which reference the same database) to be able to back up the database?