How to read MsysObjects from another db?

  • Thread starter Thread starter mikeg
  • Start date Start date
M

mikeg

Hi,

I want to get a list of queries in another access db ,
from the one i'm running vba from.

I get this error (sometimes!)
Runtime error 3112
Record(s) cannot be read; no read permission
on 'MsysObjects'

The above error only happens
sometimes i created both databases!

Here is the code that causes the error ....

Set db = OpenDatabase(txtPath + cbxDatabase)
Set rs = db.OpenRecordset(
"SELECT MSysObjects.Name
FROM MSysObjects
WHERE type=5 ORDER BY 1; ")
 
See

Microsoft Knowledge Base Article - 236878

However A easier solution is ..

DoCmd.TransferDatabase acImport, "Microsoft Access",
txtPath + txtDatabase,
acTable, "tablename", "destinationtbl"

mike
 
Back
Top