Link to home
Start Free TrialLog in
Avatar of Malik1947
Malik1947

asked on

Modify Read Permission on Multiple Databases

I am trying to retrieve and catalog the objects that reside on a list of 115 Access Databases to eliminate duplicates and give certain users access to certain objects in certain databases.

I wrote the code attached to achieve this.

My code iterates through the list of 115 databases (they reside on different network sources and drives) and then opens each one of them and tries to retrieve the object information.

My problem is that when ever I try to access that table on each individual database it returns an error.
'Record(s) cannot be read; no read permission on 'MSysObjects'

I know that if I go into each individual database and give the Admin user read rights to that table then it works but I do not want to go through this 115 times. I am hoping someone knows a different way to do this.

any help will be appreciated.
accConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;user id=Admin;Data Source=" & dbPath & "\" & dbName
    
    strSQL = "SELECT "
    strSQL = strSQL & "MSysObjects.Name, "
    strSQL = strSQL & "MSysObjects.ForeignName, "
    strSQL = strSQL & "MSysObjects.Type, "
    strSQL = strSQL & "MSysObjects.DateCreate, "
    strSQL = strSQL & "MSysObjects.DateUpdate "
    strSQL = strSQL & "FROM "
    strSQL = strSQL & "MSysObjects "
    strSQL = strSQL & "WHERE "
    strSQL = strSQL & "(((MSysObjects.Type)=1 Or "
    strSQL = strSQL & "(MSysObjects.Type)=4 Or "
    strSQL = strSQL & "(MSysObjects.Type)=5 Or "
    strSQL = strSQL & "(MSysObjects.Type)=-32761 Or "
    strSQL = strSQL & "(MSysObjects.Type)=-32764 Or "
    strSQL = strSQL & "(MSysObjects.Type)=-32768));"
    
    accObjRS.Open strSQL, accConn, adOpenForwardOnly

Open in new window

Avatar of Markus Fischer
Markus Fischer
Flag of Switzerland image

If you can't read the table, you won't be able to change the permissions either. You need to open the database using your original workgroup information file, a valid user name, and its password.

    Driver={Microsoft Access Driver (*.mdb)};
    Dbq=C:\mydatabase.mdb;
    SystemDB=C:\mydatabase.mdw;
    Uid=Malik;
    Pwd=1234;

Good luck!
(°v°)
Avatar of Malik1947
Malik1947

ASKER

thanks but that didn't work.
I'm sorry to hear that, but unless you are willing to write more than half a dozen words as feedback, I'm afraid I can't help you. What didn't work? What did you try? What did you expect? What was the result? Did you get any error messages? If so what where they? On what line of code?

The comment "it didn't work" is the most frequent on EE... and also the least useful...

(°v°)
ASKER CERTIFIED SOLUTION
Avatar of Malik1947
Malik1947

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I'm sorry I couldn't follow up on this; I was away for a couple of weeks. I have no objection in closing this question, naturally.

(°v°)