|
-
September 21st, 2001, 11:32 AM
#1
Connect to Access 2000
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
-
September 21st, 2001, 12:10 PM
#2
Re: Connect to Access 2000
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
-
September 21st, 2001, 12:44 PM
#3
Re: Connect to Access 2000
Use the following connection string
sConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & DBNAME & _
";Persist Security Info=False"
cn.Open sConn
Iouri Boutchkine
[email protected]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|