Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you open an Acess database that has security setup on it?

Status
Not open for further replies.

Paladyr

Programmer
Apr 22, 2001
508
US
The databases I work with all require you to enter a user name and password while opening them. This login screen appears to be some built in security feature in access. If I am opening recordsets by using ADO in VB, do i just put the user name and password in the connection string? I am getting errors when I try to do that now. Here is the code (maybe I am doing something else wrong?):

Sub UpdateTables()
Dim cnnCon As New Connection
Dim strCon As String
Dim rstCustomers As New Recordset
Dim rstHardware As New Recordset
Dim rstHospitalSys As New Recordset
Dim rstSpecialist As New Recordset

On Error GoTo ErrorHandler

strCon = "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=C:\Backups\controltex database 97.mdb;" & _
"Uid=*****;" & _ 'assume valid username
'and password are here
"Pwd=*****;"

cnnCon.Open strCon

Set rstCustomers = New ADODB.Recordset

'Problem here
rstCustomers.Open "customers", strCnn, , , adCmdTable

rstCustomers.Delete adAffectAll

ErrorHandler:
MsgBox Err
Resume Next
'First error is 3001, then 3704, then 0, then 20
End Sub

Any ideas?
 
Sorry that is strCon not strCnn. Still doesn't work!
 
nevermind. Found out it was connecting and opening the record properly. For some reason I cannot use the delete function. I'll repost if I need more help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top