Connecting Forms to Database

C

Chris H

I have a custom form that connects to an access 97
database. This works fine until I password protect the
database. When trying to connect to a password protected
database I get the err “Cannot start your application. The
workgroup information file is missing or opened
exclusively by another user.”
My code is as follows (with thanks to Jumpstart Outlooks
Programming by Sue Mosher)

Function Item_Open()
Dim sSelect
‘On Error Resume Next
If Item.SenderName = “” Then
sSelect
= “V:\ServiceSelector\ServiceSelector.mdb”
Set m_adoSerSel = OpenAccessDB
(sSelect, “admin”, “irate”)
End If
End Function

Function OpenAccessDB(sDBPath, UID, PWD)

Dim objADOConn
Dim sConn
‘On error Resume next

sConn = “Provider=Microsoft.Jet.OLEDB.4.0; “ &_
“Data Source=” & sDBPath & “; “ &_
“User ID=” & UID & “; “ & _
“Password=” & PWD & “; “

Set objADOConn = CreateObject(“ADODB.Connection”)
ObjADOConn.Open sConn

If (err = 0) And (objADOConn.State = adStateopen)
Then
Set OpenAccessDb = objADOConn
Else
Set OpenAccessDB = Nothing
End If

Set objADOConn = Nothing

End Function


Please Note I’ve commented out the error handlers to help
debugging (but it didn’t help that much)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top