Option Explicit On
Module connection
Public DBFile As String
Public Source As String
Public cnn1 As New ADODB.Connection
Public ShowExt As Boolean
Private HasAccess As Boolean
Public Sub connect()
Dim rs As New ADODB.Recordset
Dim location As String
location = GetSetting("Adby", "Invoiceit", "databaselocation")
'DBFile = GetSetting("horizoncomm", "bodyimage", "databaselocation") & "bodyimage.mdb"
' On Error Resume Next
DBFile = location & "InvoiceIT.accdb"
cnn1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=dbfile;Persist Security Info=True"
cnn1.Open()
Form1.dblocation.Text = "Database Location" & " " & DBFile
DBSafe:
Exit Sub
DBError:
cnn1.Close()
MsgBox(Err.Description & vbCrLf & vbCrLf & "Failed to 'connect to database", vbCritical, "Error")
Resume DBSafe
End Sub
End Module
|