obtain tables name in an access database

  • Thread starter Thread starter Paul Overway
  • Start date Start date
P

Paul Overway

Is the database secured? If yes, you need to join the workgroup associated
with that database and log in.
 
i found this code but is says i dont have permission to read in MSysobjects
how can i do it??

"SELECT MSysObjects.Name FROM MSysObjects " & _
"Where (((MSysObjects.Flags) = 0) And ((MSysObjects.Type) =
1)) " & _
"ORDER BY MSysObjects.Name"
 
Richie said:
i found this code but is says i dont have permission to read in MSysobjects
how can i do it??

"SELECT MSysObjects.Name FROM MSysObjects " & _
"Where (((MSysObjects.Flags) = 0) And ((MSysObjects.Type) =
1)) " & _
"ORDER BY MSysObjects.Name"

Try this code in a form's On Load event to fill a list box with its
rowsource type set to value list. If you still get an error, you'll need to
check your permissions:

Private Sub Form_Load()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim i As Integer
Dim strTableNames
Set db = CurrentDb

For i = 0 To db.TableDefs.Count - 1
If Left(db.TableDefs(i).Name, 4) <> "Msys" Then
strTableNames = strTableNames & db.TableDefs(i).Name & ";"
End If
Next i

Me.List0.RowSource = strTableNames 'Fill Listbox

End Sub
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
Back
Top