Click to See Complete Forum and Search --> : Connect to Access 2000


kimjam4u
September 21st, 2001, 11:32 AM
I am trying to connect a VB front end to an Access 2000 backend and am getting the following error: -2147467259(80004005) [Microsoft][ODBC Microsoft Access Drivers] could not find file '(unknown)'
Does anyone have any ideas? Thanks for any help. Here is my code.

Public Sub OpenConnection()
'On Error GoTo Err_Checker

Set cnDB = New ADODB.Connection

cnDB.ConnectionString = _
"Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=C:\MMI\Kettle\" & _
"KettleDatabse.mdb"

cnDB.Open

'Load the main form
frmMain.Show

Exit_Checker:
Exit Sub

Err_Checker:
MsgBox "OpenConnection" & vbCrLf & Err.Number & " - " & Err.Description
Resume Exit_Checker

End Sub

kimjam4u
September 21st, 2001, 12:10 PM
I figured it out. Just in case anyone else wants to know. This code seems to work.

Option Explicit
Public cnDB As adodb.Connection
Public Sub OpenConnection()
'On Error GoTo Err_Checker
Dim AccessConnect As String
Set cnDB = New adodb.Connection

AccessConnect = "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=KettleDatabase.mdb;" & _
"DefaultDir=C:\MMI\Kettle;" & _
"Uid=Admin;Pwd=;"
cnDB.ConnectionString = AccessConnect
cnDB.Open

'Load the main form
frmMain.Show

Exit_Checker:
Exit Sub

Err_Checker:
MsgBox "OpenConnection" & vbCrLf & Err.Number & " - " & Err.Description
Resume Exit_Checker

End Sub

Iouri
September 21st, 2001, 12:44 PM
Use the following connection string

sConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & DBNAME & _
";Persist Security Info=False"

cn.Open sConn

Iouri Boutchkine
iouri@hotsheet.com