Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting error: record(s) cannot be read; no read permission on 'MsysObjects'

Status
Not open for further replies.

wvdba

IS-IT--Management
Jun 3, 2008
465
0
0
US
Hi,
i have an access 2003 database with some tables. i'm trying to get a list of tables in the database. the code i'm using is:
Code:
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet  = CreateObject("ADODB.Recordset")
dbfile = "c:\a\fleet\fleet\fleet2.mdb"  
objConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
              "Data Source=" & dbfile & "; user id=Admin"
commandstring = "SELECT MSysObjects.Name FROM MsysObjects WHERE " & _
      "(Left$([Name],1)<>" & chr(39) & "~" & chr(39) & ") " & _ 
      "AND (Left$([Name],4) <> " & chr(39) & "Msys" & chr(39) & ") " & _ 
      "AND (MSysObjects.Type)=1 ORDER BY MSysObjects.Name;"
msgbox commandstring
objRecordSet.Open commandstring, objConnection, adOpenStatic, adLockOptimistic
	  objRecordSet.MoveFirst
Do Until objRecordSet.EOF
    strText = objRecordset.Fields.Item("name") 
    msg = msg & strText & vbcrlf 
    objRecordSet.MoveNext
Loop
msgbox msg
however, i'm getting the error
record(s) cannot be read; no read permission on 'MsysObjects'
when i run my script with access 2000, it works ok, but not with access 2003
any help is appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top