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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Security with Access and ODBC

Status
Not open for further replies.

hatchetman

Programmer
Jul 18, 2002
6
US
I have a MS Access database that I access from VB through ODBC using ADODB. I want to allow some users of my VB program to have full read/write access to the DB while others should have read-only access. I set up a database password, as well as User permissions at different levels for the tables. How do I utilize the Access DB's User permissions from my VB program? I also set the authorization for ODBC to match the database password.

So far...

Set DBConn = New ADODB.Connection
DBConn.Open DSNName, "doesnt seem to matter", "dbpasswd"

This gives everyone read/write permission. How do I specifiy which User to login from VB?

Thanks,

Dave
 
You can customize your logins by ID an Password, Right??

Hope this function help

Function GetJetConnection(strDBPath As String, _
lngMode As ADODB.ConnectModeEnum, _
Optional strDBPwd As String, _
Optional strSysDBPath As String, _
Optional strUserID As String, _
Optional strUserPwd As String, _
Optional lngEngineType As opgJetEngineType) _
As ADODB.Connection
Dim cnnDB As ADODB.Connection

Set cnnDB = New ADODB.Connection

With cnnDB
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Mode = lngMode
.Properties("Jet OLEDB:Database Password") = strDBPwd
.Properties("Jet OLEDB:System Database") = strSysDBPath
.Properties("Jet OLEDB:Engine Type") = lngEngineType
.Open ConnectionString:=strDBPath, _
UserID:=strUserID, _
Password:=strUserPwd
End With

Set GetJetConnection = cnnDB
End Function
Best Regards

---
JoaoTL
mail@jtl.co.pt
My MS Access Site:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top