Record(s) cannot be read; no read permission on 'msysobjects'

I get error 'Record(s) cannot be read; no read permission on 'msysobjects' 'on the line given below.. any ideas how to resolve this error

Dim TableName(100)
Dim DatabasePath(100)
Dim NO_of_Records

Dim conn
Dim rec
Dim j

j = 1

Set conn = New ADODB.Connection
Set rec = New ADODB.Recordset
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\AiyshaTest\AiyshaTest.mdb;Persist Security Info=False"
esql = "SELECT Name, Database, Connect FROM msysobjects WHERE (Type=1 Or Type=4 Or Type=6) And Name Not Like ""MSys*"" ORDER BY Name"
MsgBox esql
rec.Open (esql), conn, adOpenStatic, adLockReadOnly
If rec.RecordCount > 0 Then
Do Until rec.EOF
TableName(j) = rec.Fields(0).Value
DatabasePath(j) = rec.Fields(1).Value
NO_of_Records(j) = rec.Fields(2).Value
j = j + 1
End If
Set conn = Nothing

End Sub
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hi Aiysha,

that table is hidden and used by Access itself you can use

rec = conn.OpenSchema(adSchemaTables)
While Not adors.EOF
    Debug.Print rec.Fields(0) ' DB
    Debug.Print rec.Fields(1) ' Owner
    Debug.Print rec.Fields(2) ' TableName
    Debug.Print rec.Fields(3) ' Type

i tried it here on a SQL Server so not sure if the fields returned are the same

hope this helps a bit

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AiyshaAuthor Commented:
I changed the method to DAO..
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.