Click here to Skip to main content
15,900,553 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Please help, this is the error i am getting

Record(s) cannot be read; no read permission on 'MSysObjects
(I am using Access 2007)

Dim ds As New DataSet<br mode=" provider="Microsoft.Jet.OLEDB.4.0;Data" source="D:\Sample.mdb")<br" mode="hold" />        cn.Open()
        Dim cmd As New OleDbCommand("SELECT Name FROM MSysObjects WHERE type=1 and flags=0", cn)
        Dim dr As OleDbDataReader
        dr = cmd.ExecuteReader()
        While (dr.Read())
        End While

The above is my code, how do i solve this permission
Updated 30-May-11 21:27pm

1 solution

Use the code below to get table names in mdb:

Dim sConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Sample.mdb"
Dim olecon As New OleDbConnection(sConn)
Dim dt As DataTable = olecon.GetSchema("tables")
GridView1.DataSource = dt

If you wish to give permission to MSysObjects follow instruction below:
1) Tools -> Options, on the view tab check 'system object'.
2) Tools -> Security -> User and group permissions, on each of the new tables give it 'administrator' access.

Source @[^]
Share this answer
amitk_189 31-May-11 3:37am    
But i want only table name in Listview, not in Datagrid
amitk_189 31-May-11 3:37am    
How do i write query
Wild-Programmer 31-May-11 4:03am    
I gave an example. From the data table you can copy the table names in Listview or whatever control you want.
Maciej Los 31-May-11 15:46pm    
This is it. For me 5.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900