Instantly share code, notes, and snippets.

What would you like to do?
Option Explicit
Public Function GetOpenConnection() As ADODB.Connection
Dim conn As ADODB.Connection
Dim strCon As String
On Error GoTo errHandle
strCon = "DRIVER=SQLite3 ODBC Driver;Database=" & App.Path & "\db\Northwind.db;LongNames=0;Timeout=1000;NoTXN=0;SyncPragma=NORMAL;StepAPI=0"
Set conn = New ADODB.Connection
conn.ConnectionString = strCon
Set GetOpenConnection = conn
Exit Function
' do nothing
End Function
Public Sub CloseConnection(ByVal conn As ADODB.Connection)
If Not conn Is Nothing Then
If conn.State = adStateOpen Then conn.Close
Set conn = Nothing
End If
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment