And here is another method of connecting to DB using ADODB connection using code.
Public Sub ConnectToDB()
Dim CON As ADODB.Connection
Dim CMD As ADODB.Command
Dim conString As String
conString = "DBQ=" & App.Path & "\Database.mdb" & "; Driver={Microsoft Access Driver (*.mdb)};"
Set CON = New ADODB.Connection
With CON
.ConnectionString = conString
.Open , "Admin", "yourDBpassword"
End With
End Sub
Public Sub DisconnectFromDB()
Set CMD = Nothing
CON.Close
Set CON = Nothing
End Sub
ConnectToDB will connect to your database and DisconnectFromDB will disconnect it.
Thanks