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?
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?