I do not think I have any open objects when the routine is done. I also
don't think that it is the code because I get the problem the first time the
code runs if I open the form from design view so there should not be any open
objects even if I did not close them in code.
Just to make sure I am being clear - If I open the form in form view first,
I can run the process as much as I want with out problems. However, if I go
into design view either first or from form view, when I go back to form view,
I get the error. It does not matter if the routine was run before entering
design view or not.
Here is the connection code and clean up. there are a bunch of rst that are
not listed but they are handled the same.
Dim conn As ADODB.Connection
Dim rstMSD As ADODB.Recordset
Dim fld As Field
Dim objNode1 As Node
Dim objNode2 As Node
'Create the ADO Connection object
Set conn = New ADODB.Connection
'Specify a valid connection string
strConn = "Data Provider=Microsoft.Jet.OLEDB.4.0;"
strConn = strConn & "Data Source = " & _
CurrentProject.Connection.ConnectionString
conn.ConnectionString = strConn
gblbooCurrentYrData = True
'Specify the Data Shaping provider
conn.Provider = "MSDataShape"
'Open the connection
conn.Open
[do a bunch of stuff with a SQL Shape Stmt - add records to treeview, ....]
'clean up code
conn.Close
set rstMSD = nothing
Set conn = Nothing
Set fld = Nothing
Set objNode1 = Nothing
Set objNode2 = Nothing
|