How manage automatic closing SQLite3Close() of remaining opened descriptors to Databases

Jul 23, 2013 at 2:52 PM
How ensure a proper and total closing of all remaining "connections" to database files. ?

When we use the VBA SQLite3Open() function, we expect no strange Excel behaviors.

Sometimes, due to "bad' VBA code or any other special Excel behavior (mainly when debugging), opened connections could remain and it could be nice to force them to be automatically closed without having to close Excel application. (eg. when UserForm_Terminate())
Even if SQlite3 Dlls are unloaded, file descriptors to database files remain opened and it seems to be impossible to close them without stopping the Excel application itself.
...
Any suggestions ?

Regards

Nikola
Jul 23, 2013 at 7:25 PM
Hi Nikola,

I don't know of a general solution to this.

You might experiment a bit with wrapping the API in Class modules, and doing the clean-up in the Class_Terminate handlers.
Otherwise try to wrap things with On Error handlers that run even if there are errors.

-Govert
Jul 24, 2013 at 11:22 AM
Hi,

I tried by using a specific class module to manage connections and it works perfectly now.
No more lost connection remains.
Thanks

Regards

Nikolq