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

Posted on 2006-05-03
Last Modified: 2008-01-09
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
Question by:Aiysha
    LVL 44

    Accepted Solution

    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

    Author Comment

    I changed the method to DAO..

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
    You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now