Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2004
    Posts
    1

    Unanswered: Querying an Access DB to find out Table and Query info

    I have an Access 2000 db and am writing a VB6 front end
    Is there any way to 'query' the db to list all Tables and Queries store in the db?

  2. #2
    Join Date
    Jan 2004
    Posts
    184

    Re: Querying an Access DB to find out Table and Query info

    Private Sub DisplayInfo()

    Dim oRsTables As ADODB.Recordset Dim oRsFields As ADODB.Recordset Dim oCnn As New
    ADODB.Connection

    ' change this to your SQL Server or Access DB. Dim sCnn As String: sCnn =
    "Provider=SQLOLEDB.1;" & _ "Integrated Security=SSPI;" & _ "Persist Security
    Info=False;" & _ "Initial Catalog=Northwind;" & _ "Data Source=BENDER"

    With oCnn .ConnectionString = sCnn .Open

    Set oRsTables = .OpenSchema(adSchemaTables)

    Do While Not oRsTables.EOF If oRsTables("TABLE_TYPE").Value = "TABLE" Then
    Debug.Print "Table: " & oRsTables("TABLE_NAME").Value Set oRsFields =
    .OpenSchema(adSchemaColumns, _ Array(Empty, Empty,
    oRsTables("TABLE_NAME").Value, Empty)) Do While Not oRsFields.EOF Debug.Print
    " Column: " & oRsFields("COLUMN_NAME").Value oRsFields.MoveNext Loop
    Debug.Print End If oRsTables.MoveNext Loop End With

    End Sub
    In abundance of water only the fool is thirsty. Bob Marley.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •