How to read MsysObjects from another db?

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; ")
 
M

mikeg

See

Microsoft Knowledge Base Article - 236878

However A easier solution is ..

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

mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top