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

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

        Try
            Me.ComboBox1.Items.Add("")

            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)
            connection.Open()
            Dim datareader As OleDbDataReader = cmd.ExecuteReader
            Me.ComboBox1.Items.Clear()
            While datareader.Read
                If Not datareader("Name").Equals(DBNull.Value) Then
                    Me.ComboBox1.Items.Add(datareader("Name"))
                End If
            End While
            connection.Close()
        Catch ex As Exception
            MsgBox(ex.Message & " 67b")
        End Try

    End Sub
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAsked:
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.

Jeffrey CoachmanMIS LiasonCommented:
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"

JeffCoachman
0
Jeffrey CoachmanMIS LiasonCommented:
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"
0

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
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
@Jeff,

  This is .Net code...

@murbro,

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

Jim.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Hi Jim. Thanks. It is a .accdb database
0
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
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")
0
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
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).

Jim.
0
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
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
0
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks. Sorry about late reply
0
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.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.