B
bissettbd2
Guest
Using Microsoft Excel VBA to Query Access.
With an mdb file this connection string opens the mdb file fine and the SQL String returns the tables I want.
Connection String: Provider=Microsoft.Jet.OLEDB.4.0;Data Source="C:\My Files\Word\ADA II Text\Chapters\9 -
8\Access\ADAIICH9TEST.mdb";User Id=admin;Password=;
SQL String: SELECT MSysObjects.Name From MSysObjects WHERE MSysObjects.Name Not Like "MSyS*" And Type=1 AND
Flags=0 ORDER BY MSysObjects.Name;
With an accdb file this connection string opens the accdb file fine but the SQL throws the following error:
Connection String: Provider=Microsoft.ACE.OLEDB.12.0;Data Source="P:\My Files\Word\ADA II Text\Chapters\9 -
8\Access\ADAIICH9TEST.accdb";User Id=admin;Password=;
SQL String: SELECT MSysObjects.Name From MSysObjects WHERE MSysObjects.Name Not Like "MSyS*" And Type=1 AND
Flags=0 ORDER BY MSysObjects.Name;
Error No: -2147217911 Error Desc: Record(s) cannot be read; no read permission on 'MSysObjects'.
Why does it have access to MSysObjects when reading the mdb file but not the accdb file?
How do I grant access either programmatically or from within the Access File?
I have already tried executing the following statements prior to running the SQL:
'cn.Execute "GRANT SELECT ON MSysObjects TO Admin;"
'cn.Execute "GRANT SELECT ON TABLE MSysObjects TO PUBLIC;"
They throw the error:
Error No: -2147467259 Error Desc: Cannot open the Microsoft Access database engine workgroup information
file.
Continue reading...
With an mdb file this connection string opens the mdb file fine and the SQL String returns the tables I want.
Connection String: Provider=Microsoft.Jet.OLEDB.4.0;Data Source="C:\My Files\Word\ADA II Text\Chapters\9 -
8\Access\ADAIICH9TEST.mdb";User Id=admin;Password=;
SQL String: SELECT MSysObjects.Name From MSysObjects WHERE MSysObjects.Name Not Like "MSyS*" And Type=1 AND
Flags=0 ORDER BY MSysObjects.Name;
With an accdb file this connection string opens the accdb file fine but the SQL throws the following error:
Connection String: Provider=Microsoft.ACE.OLEDB.12.0;Data Source="P:\My Files\Word\ADA II Text\Chapters\9 -
8\Access\ADAIICH9TEST.accdb";User Id=admin;Password=;
SQL String: SELECT MSysObjects.Name From MSysObjects WHERE MSysObjects.Name Not Like "MSyS*" And Type=1 AND
Flags=0 ORDER BY MSysObjects.Name;
Error No: -2147217911 Error Desc: Record(s) cannot be read; no read permission on 'MSysObjects'.
Why does it have access to MSysObjects when reading the mdb file but not the accdb file?
How do I grant access either programmatically or from within the Access File?
I have already tried executing the following statements prior to running the SQL:
'cn.Execute "GRANT SELECT ON MSysObjects TO Admin;"
'cn.Execute "GRANT SELECT ON TABLE MSysObjects TO PUBLIC;"
They throw the error:
Error No: -2147467259 Error Desc: Cannot open the Microsoft Access database engine workgroup information
file.
Continue reading...