home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
- Begin VB.Form DBStructureForm
- Caption = "Database Structure"
- ClientHeight = 6285
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 7845
- LinkTopic = "Form1"
- ScaleHeight = 6285
- ScaleWidth = 7845
- StartUpPosition = 3 'Windows Default
- Begin VB.TextBox txtSQL
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 2040
- Left = 3540
- Locked = -1 'True
- MultiLine = -1 'True
- ScrollBars = 2 'Vertical
- TabIndex = 5
- Top = 3990
- Width = 3930
- End
- Begin VB.ListBox QryList
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 1980
- Left = 165
- TabIndex = 4
- Top = 4005
- Width = 3090
- End
- Begin VB.CommandButton Command1
- Caption = "Open Database"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 165
- TabIndex = 3
- Top = 165
- Width = 1755
- End
- Begin MSComDlg.CommonDialog CommonDialog1
- Left = 6780
- Top = 600
- _ExtentX = 847
- _ExtentY = 847
- _Version = 393216
- FontSize = 1.17491e-38
- End
- Begin VB.ListBox FldList
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 2220
- Left = 3540
- TabIndex = 1
- Top = 1095
- Width = 3930
- End
- Begin VB.ListBox TblList
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 2220
- Left = 165
- TabIndex = 0
- Top = 1110
- Width = 3090
- End
- Begin VB.Label lblFields
- Caption = "Selected Table's Fields"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 270
- Left = 3540
- TabIndex = 9
- Top = 765
- Width = 2940
- End
- Begin VB.Label lblTables
- Caption = "Tables"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 270
- Left = 165
- TabIndex = 8
- Top = 720
- Width = 1755
- End
- Begin VB.Label lblQuery
- Caption = "Selected Query Definition"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 300
- Left = 3540
- TabIndex = 7
- Top = 3645
- Width = 3510
- End
- Begin VB.Label lblQueries
- Caption = "Queries"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 300
- Left = 165
- TabIndex = 6
- Top = 3585
- Width = 1890
- End
- Begin VB.Label Label1
- BorderStyle = 1 'Fixed Single
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 2040
- TabIndex = 2
- Top = 165
- Width = 5715
- End
- Attribute VB_Name = "DBStructureForm"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Dim DB As Database
- Private Sub Command1_Click()
- On Error GoTo NoDatabase
- CommonDialog1.CancelError = True
- CommonDialog1.Filter = "Databases|*.mdb"
- CommonDialog1.ShowOpen
- ' Open the database
- If CommonDialog1.FileName <> "" Then
- Set DB = OpenDatabase(CommonDialog1.FileName)
- Label1.Caption = CommonDialog1.FileName
- End If
- ' Clear the ListBox controls
- FldList.Clear
- TblList.Clear
- Dim tbl As TableDef
- Dim idx As Index
- Dim TName As String
- Debug.Print "There are " & DB.TableDefs.Count & " tables in the database"
- ' Process each table
- For Each tbl In DB.TableDefs
- ' EXCLUDE SYSTEM TABLES
- If Left(tbl.Name, 4) <> "MSys" And Left(tbl.Name, 4) <> "USys" Then
- TblList.AddItem tbl.Name
- ' For each table, process the table's indices
- For Each idx In tbl.Indexes
- TblList.AddItem " " & idx.Name
- Next
- End If
- Next
- Dim qry As QueryDef
- Debug.Print "There are " & DB.QueryDefs.Count & " queries in the database"
- ' Process each stored query
- For Each qry In DB.QueryDefs
- QryList.AddItem qry.Name
- Next
- NoDatabase:
- End Sub
- Private Sub QryList_Click()
- Dim qry As QueryDef
- txtSQL.Text = DB.QueryDefs(QryList.ListIndex).SQL
-
- End Sub
- Private Sub TblList_Click()
- Dim fld As Field
- Dim idx As Index
- If Left(TblList.Text, 2) = " " Then Exit Sub
- FldList.Clear
- For Each fld In DB.TableDefs(TblList.Text).Fields
- FldList.AddItem fld.Name
- Next
- End Sub
-