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!

No read permissions when using DAO to open table

Status
Not open for further replies.

Paladyr

Programmer
Apr 22, 2001
508
US
Here is the code:

Code:
Private Sub Form_Load()
Dim strCnn As String
Dim dbFac As DAO.Database
Dim db As DAO.Database
Dim rstFac As DAO.Recordset
Dim strError As String

  Set db = OpenDatabase _
  ("C:\Projects\CustomReports\Hermann\ctx.mdb", _
  False, False, "Ms Access;PWD=****")
  
  Set rstFac = db.OpenRecordset("Hospitals", dbOpenSnapshot, dbReadOnly)
  End Sub
[\code]

I am getting the error message "No read permissions on the table Hospitals."  Does DAO open tables using the "Admin" user account by default???  Is that why this isn't working (admin account does not have any permissions)?  We have applications that connect to these databases so must they have user id's that they use to connect to the database?  How would I specify a user id???  Thanks in advance!
 
Not sure but i think the answer is

Set db = OpenDatabase _
("C:\Projects\CustomReports\Hermann\ctx.mdb", _
False, False, "Ms Access;User = currentuser, PWD=****")

currentuser returns the user id and by using it lke this it will log the user in using their ID rather than ADMIN.

Hope this helps

 
Thank you for the reply! Unfortunately, I'm not sure what user id's I could use to try this. My inclination is to say that it wouldn't work because Access would think you are connecting using:

User: UserID
Password: ****

Instead of using the password just to open the database (it is password protected). I wonder if there is a way to supply it with both a login (user and password) as well as the password to open the database??? Thanks again for the reply!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top