home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / as2db1 / seltable.frm (.txt) < prev   
Encoding:
Visual Basic Form  |  1994-01-01  |  2.2 KB  |  82 lines

  1. VERSION 2.00
  2. Begin Form frmSelTable 
  3.    BorderStyle     =   3  'Fixed Double
  4.    Caption         =   "Select Table"
  5.    ClientHeight    =   1575
  6.    ClientLeft      =   3090
  7.    ClientTop       =   2700
  8.    ClientWidth     =   5250
  9.    ControlBox      =   0   'False
  10.    Height          =   1980
  11.    Left            =   3030
  12.    LinkTopic       =   "Form2"
  13.    ScaleHeight     =   1575
  14.    ScaleWidth      =   5250
  15.    Top             =   2355
  16.    Width           =   5370
  17.    Begin CommandButton Command1 
  18.       Cancel          =   -1  'True
  19.       Caption         =   "&Cancel"
  20.       Height          =   375
  21.       Left            =   2880
  22.       TabIndex        =   3
  23.       Top             =   1080
  24.       Width           =   975
  25.    End
  26.    Begin CommandButton cmdOK 
  27.       Caption         =   "&OK"
  28.       Default         =   -1  'True
  29.       Height          =   375
  30.       Left            =   4080
  31.       TabIndex        =   2
  32.       Top             =   1080
  33.       Width           =   975
  34.    End
  35.    Begin ComboBox cmbSelectTable 
  36.       Height          =   300
  37.       Left            =   480
  38.       TabIndex        =   0
  39.       Top             =   600
  40.       Width           =   4575
  41.    End
  42.    Begin Label Label1 
  43.       Caption         =   "Select a table:"
  44.       Height          =   255
  45.       Left            =   240
  46.       TabIndex        =   1
  47.       Top             =   240
  48.       Width           =   4215
  49.    End
  50. Option Explicit
  51. Sub cmdOK_Click ()
  52.   'cmbSelectTable.Text = cmbSelectTable.List(cmbSelectTable.ListIndex)
  53.   Form1!lblCurrTable = cmbSelectTable.Text
  54.   Unload Me
  55. End Sub
  56. Sub Command1_Click ()
  57.   Unload Me
  58. End Sub
  59. Sub CreateList ()
  60.     Dim Msg
  61.     Dim td As TableDef
  62.     Dim db As Database
  63.     Dim tCount, i
  64.     On Error GoTo SetError
  65.     Set db = OpenDatabase(Form1!lblCurrDatabase)
  66.     tCount = db.TableDefs.Count
  67.     For i = 0 To tCount - 1
  68.       If (db.TableDefs(i).Attributes And DB_SYSTEMOBJECT) = False Then cmbSelectTable.AddItem db.TableDefs(i).Name
  69.     Next
  70.     cmbSelectTable.Text = Form1!lblCurrTable
  71.     Exit Sub
  72. SetError:
  73.     Msg = Err & " " & Error & NL
  74.     Msg = Msg & " Trying to open database"
  75.     MsgBox Msg
  76.     Unload Me
  77.     Exit Sub
  78. End Sub
  79. Sub Form_Load ()
  80.   CreateList
  81. End Sub
  82.