SQL server
select * from sysobjects where xtype = 'U'

解决方案 »

  1.   

    Public Function NonSystemTables(dbPath As String) As Collection'Input: Full Path to an Access Database'Returns: Collection of the names
    'of non-system tables in that database
    'or Nothing if there is an error'Requires: a reference to data access
    'objects (DAO) in your projectOn Error GoTo ErrHandlerDim td As DAO.TableDef
    Dim db As DAO.Database
    Dim colTables As CollectionSet db = workspaces(0).opendatabase(dbPath)Set colTables = New Collection For Each td In db.TableDefs    If td.Attributes >= 0 And td.Attributes <> dbHiddenObject _
             And td.Attributes <> 2 Then
       
              colTables.Add td.Name
        End If
      Next
    db.close
    Set NonSystemTables = colTablesExit Function
    ErrHandler:
    On Error Resume Next
    If Not db Is Nothing Then db.CloseSet NonSystemTables = NothingEnd Function
      

  2.   

    使用ADO必须使用ADOX才能得到数据库中的表集合,查询集合
    在VB中引用一下ADOX.
      

  3.   

    ADO:
    Public Sub OpenSchemaX() Dim cnn1 As ADODB.Connection
    Dim rstSchema As ADODB.Recordset
    Dim strCnn As String

    Set cnn1 = New ADODB.Connection
    strCnn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=yourDB.mdb;Persist Security Info=False" 
    cnn1.Open strCnn

    Set rstSchema = cnn1.OpenSchema(adSchemaTables)

    Do Until rstSchema.EOF
    Debug.Print "Table name: " & _
    rstSchema!TABLE_NAME & vbCr & _
    "Table type: " & rstSchema!TABLE_TYPE & vbCr
    rstSchema.MoveNext
    Loop
    rstSchema.Close

    cnn1.Close

    End Sub
      

  4.   

    access里也有类似SQL SERVER的SYSOBJECTS的系统表,到ACCESS里找找,默认是隐藏的。
      

  5.   

    同意XLYT(雨田),Access中是这样的:
    select name from MSysObjects;
    当然of123()的方法也可以。
      

  6.   

    看一下 FAQ ,就有答案以前这样的问题太多了建议搜索一下以前的贴子