Click here to Skip to main content
14,383,511 members
Rate this:
Please Sign up or sign in to vote.
See more:
I have install ms-office 2007. I check that my table is exist in access(.accdb) database. I write the query in below:
'SELECT MSysObjects.Name FROM MSysObjects WHERE MSysObjects.Name = tablename'
this above query is running in MS-Access 2007.

When this above query is running through their arise a error msg ('no read permission MSysObjects')
Updated 17-Nov-11 2:10am
Slacker007 17-Nov-11 6:31am
Not a good idea to be messing around with MSysObjects table(s). They are needed to run Access and thus they are hidden by design.

Your second question, requires you to manipulate the table structure (obviously). The best way to do this, I have found is through OleDb or ADO. There is plenty of info on the internet for this.

Good luck.
Kschuler 17-Nov-11 12:15pm
You posted this question three times. Please do not do that. If you have more information to add to an already existing question you can go to that question and click the Improve question button to revise it.
Rate this:
Please Sign up or sign in to vote.

Solution 2

If what you are trying to accomplish is to get a list of tables in the database, you may want to go about it a different way. Instead of a query to the MSysObjects you could use a .GetSchema on the connection. I used this code for an Access 2003 database, it's probably a bit different for 2007 but they must have something similar. At least it would be a place for you to start researching.

Dim dtTables As New DataTable
Dim tempConn As New OleDb.OleDbConnection(gblstrConnectionString)

If tempConn.State <> ConnectionState.Open Then
End If

Dim tblRestrictions As String() = New String() {Nothing, Nothing, Nothing, "TABLE"}
dtTables = tempConn.GetSchema("tables", tblRestrictions)

'Now you have a table full of information about the tables in the database

For Each row as DataRow In dtTables.Rows 'Loop through each table
   'Add code here to do whatever you want with each table,
   'for example if you want to get the table name:
   Dim strTableName as String = row("Table_Name").ToString.Trim
Rate this:
Please Sign up or sign in to vote.

Solution 1

Solution for 2nd problem:-

In create table query write like this....Create Table table_name (field_name counter , field_name2 ....)

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

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100