Solved Access Record(s) cannot be read. No read permission on "MySysObjects"

Posted on 2014-08-11
Last Modified: 2014-09-08
Hi. I am using the following code to get a list of the Access queries in am Access database
but get the error:
Record(s) cannot be read. No read permission on "MySysObjects"

   Sub Populate_Combo_With_Access_Queries()

        'Dim oTable As New DataTable


            Dim sSQL As String = "SELECT [Name] FROM MSysObjects WHERE [Type] = 5"

            Dim connection As New OleDbConnection(Form_Settings.txtAccessConnectionString.Text)
            Dim cmd As New OleDbCommand(sSQL, connection)
            Dim datareader As OleDbDataReader = cmd.ExecuteReader
            While datareader.Read
                If Not datareader("Name").Equals(DBNull.Value) Then
                End If
            End While
        Catch ex As Exception
            MsgBox(ex.Message & " 67b")
        End Try

    End Sub
Question by:murbro
    LVL 74

    Expert Comment

    by:Jeffrey Coachman
    Then try copying the MSysObjects table in code, ...then rename it, ...then query the copy:

        DoCmd.CopyObject , "AccessObjects", acTable, "MSysObjects"

    Then sSQL will be:
    ="SELECT [Name] FROM AccessObjects WHERE [Type] = 5"

    LVL 74

    Accepted Solution

    This is a bit more safe

    'If AccessObjects does not exist, ...just continue and copy MSysObjects
    On Error Resume Next
    'Delete old AccessObjects
    DoCmd.DeleteObject acTable, "AccessObjects"
    'Copy MSysObjects as AccessObjects
    DoCmd.CopyObject , "AccessObjects", acTable, "MSysObjects"
    LVL 56

    Expert Comment

    by:Jim Dettman (Microsoft MVP/ EE MVE)

      This is .Net code...


       The DB your going against, is it a MDB file or a ACCDB?   If a MDB, do you know if the DB was secured?


    Author Comment

    Hi Jim. Thanks. It is a .accdb database

    Author Comment

    If I reference the Microsoft Access 14.0 Object library it causes errors relating to Ribbon button control size so I don't want to connect to Access in this way. I am however connecting to Access using the following sort of code. So how would I get a list of Access Queries in this way?

         Dim connection As New OleDbConnection(cs
                    Dim da As OleDbDataAdapter = New OleDbDataAdapter(sSQL, connection)
                    da.Fill(oDataSet, "MyTableDT6")
                    Me.DGV_Other.DataSource = oDataSet.Tables("MyTableDT6")
    LVL 56

    Expert Comment

    by:Jim Dettman (Microsoft MVP/ EE MVE)
    What does your connection string look like?
    What format is the DB in? (MDB or ACCDB)?
    Is this running in 32 or 64 bit?
    Has the database been secured with a password?
    Has the database been secured with ULS (User Level or Workgroup security).


    Author Comment

    Connection String
    Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\murbro\Dropbox\Online Excel\Malandela 11oes.accdb;
    Database is .accdb
    64 bit
    No password
    Not secured with ULS

    Author Closing Comment

    Thanks. Sorry about late reply

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    This article is a continuation or rather an extension from Cascading Combos ( and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
    Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
    Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
    In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

    734 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

    19 Experts available now in Live!

    Get 1:1 Help Now