If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > Querying an Access DB to find out Table and Query info

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-05-04, 15:19
MickeyMarshall MickeyMarshall is offline
Registered User
 
Join Date: Feb 2004
Posts: 1
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?
Reply With Quote
  #2 (permalink)  
Old 02-23-04, 11:01
rami.haddad rami.haddad is offline
Registered User
 
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.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On