Public cn As ADODB.Connection
Public Function DBConnect() As Boolean
On Error GoTo OpenErr
Dim MSDatabase
Dim str As String Set cn = New ADODB.Connection
cn.CursorLocation = adUseClient
str = "DBQ=" & App.Path & "\db.mdb;" & "DefaultDir=" & App.Path & ";" ' database name and directory
str = str + "Driver={Microsoft Access Driver (*.mdb, *.accdb)};"
str = str + "PWD=dbb;UID=admin;" ' password & user id
str = str + "DriverId%;FIL=MS Access;MaxBufferSize 48;MaxScanRows=8;PageTimeout=5;SafeTransactions=0;T hreads=3;UserCommitSync=Yes;"
cn.ConnectionString = str
cn.Open DBConnect = True
Exit Function
OpenErr:
MsgBox "Error Opening " & MSDatabase & vbNewLine & Err.Description, vbCritical, "Open Database Error"
DBConnect = False
End Function
'You just use the above code it will work nicely instead of Jet OLEDB 4.0
Saturday, July 5, 2008
The workgroup Information file is missing or opened exclusively by another user in VB 6.0
The below code will be helpful if you have the error like The workgroup Information file is missing or opened exclusively by another user in VB 6.0
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment