TimHudspith
asked on
How to close ADO Data Control connection?
Within an Excel VBA application, I'm using the ADO Data Control to populate a DataGrid with data from an Access table.
I set the connection and recordsource properties on opening the file, then set them to empty strings on closing. However once my app. is closed there still exists an Access record-locking icon for the database in Explorer.
I don't seem to be able to close the database; the ADO Data Control doesn't have a connection.close method. How do I do it? It's even causing a fatal error on Windows shutdown.
I set the connection and recordsource properties on opening the file, then set them to empty strings on closing. However once my app. is closed there still exists an Access record-locking icon for the database in Explorer.
I don't seem to be able to close the database; the ADO Data Control doesn't have a connection.close method. How do I do it? It's even causing a fatal error on Windows shutdown.
ASKER
How do I bind the DataGrid to the recordset?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks.
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
and so on. Once you create the recordset you bind it to the DataGrid. At the end:
rs.Close
Set rs = Nothing
conn.Close
Set conn = Nothing
Leon