home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / PVb5.0 / VB / SAMPLES / VISDATA / TBLSTRU.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-01-13  |  28.7 KB  |  940 lines

  1. VERSION 5.00
  2. Begin VB.Form frmTblStruct 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "
  5.    ClientHeight    =   6135
  6.    ClientLeft      =   1560
  7.    ClientTop       =   945
  8.    ClientWidth     =   7680
  9.    HelpContextID   =   2016147
  10.    Icon            =   "TBLSTRU.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    LockControls    =   -1  'True
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   6135
  16.    ScaleWidth      =   7680
  17.    ShowInTaskbar   =   0   'False
  18.    StartUpPosition =   1  'CenterOwner
  19.    Begin VB.PictureBox picFieldProps 
  20.       Appearance      =   0  'Flat
  21.       BorderStyle     =   0  'None
  22.       Enabled         =   0   'False
  23.       ForeColor       =   &H80000008&
  24.       Height          =   615
  25.       Left            =   3120
  26.       ScaleHeight     =   615
  27.       ScaleWidth      =   4455
  28.       TabIndex        =   40
  29.       TabStop         =   0   'False
  30.       Top             =   4335
  31.       Width           =   4455
  32.       Begin VB.CheckBox chkUnique 
  33.          Caption         =   "
  34.          Enabled         =   0   'False
  35.          Height          =   255
  36.          Left            =   1560
  37.          MaskColor       =   &H00000000&
  38.          TabIndex        =   45
  39.          TabStop         =   0   'False
  40.          Top             =   0
  41.          Width           =   1230
  42.       End
  43.       Begin VB.CheckBox chkRequiredInd 
  44.          Caption         =   "
  45.          Enabled         =   0   'False
  46.          Height          =   255
  47.          Left            =   120
  48.          MaskColor       =   &H00000000&
  49.          TabIndex        =   44
  50.          TabStop         =   0   'False
  51.          Top             =   360
  52.          Width           =   1230
  53.       End
  54.       Begin VB.CheckBox chkIgnoreNull 
  55.          Caption         =   "
  56.          Enabled         =   0   'False
  57.          Height          =   255
  58.          Left            =   1560
  59.          MaskColor       =   &H00000000&
  60.          TabIndex        =   43
  61.          TabStop         =   0   'False
  62.          Top             =   360
  63.          Width           =   1230
  64.       End
  65.       Begin VB.CheckBox chkPrimary 
  66.          Caption         =   "
  67.          Enabled         =   0   'False
  68.          Height          =   255
  69.          Left            =   120
  70.          MaskColor       =   &H00000000&
  71.          TabIndex        =   42
  72.          TabStop         =   0   'False
  73.          Top             =   0
  74.          Width           =   1230
  75.       End
  76.       Begin VB.CheckBox chkForeign 
  77.          Caption         =   "
  78.          Enabled         =   0   'False
  79.          Height          =   255
  80.          Left            =   3120
  81.          MaskColor       =   &H00000000&
  82.          TabIndex        =   41
  83.          TabStop         =   0   'False
  84.          Top             =   0
  85.          Width           =   1230
  86.       End
  87.    End
  88.    Begin VB.PictureBox picFieldProps2 
  89.       Appearance      =   0  'Flat
  90.       BorderStyle     =   0  'None
  91.       ForeColor       =   &H80000008&
  92.       Height          =   1815
  93.       Left            =   4560
  94.       ScaleHeight     =   1815
  95.       ScaleWidth      =   3015
  96.       TabIndex        =   38
  97.       TabStop         =   0   'False
  98.       Top             =   1920
  99.       Width           =   3015
  100.       Begin VB.CheckBox chkRequired 
  101.          Caption         =   "
  102.          Height          =   255
  103.          Left            =   1200
  104.          MaskColor       =   &H00000000&
  105.          TabIndex        =   7
  106.          Top             =   360
  107.          Width           =   1215
  108.       End
  109.       Begin VB.CheckBox chkAllowZeroLen 
  110.          Caption         =   "
  111.          Height          =   255
  112.          Left            =   1200
  113.          MaskColor       =   &H00000000&
  114.          TabIndex        =   5
  115.          Top             =   0
  116.          Width           =   1695
  117.       End
  118.       Begin VB.TextBox txtOrdinalPos 
  119.          Height          =   285
  120.          Left            =   0
  121.          TabIndex        =   6
  122.          Top             =   360
  123.          Width           =   1095
  124.       End
  125.       Begin VB.TextBox txtValidationText 
  126.          Height          =   285
  127.          Left            =   0
  128.          TabIndex        =   8
  129.          Top             =   720
  130.          Width           =   2895
  131.       End
  132.       Begin VB.TextBox txtValidationRule 
  133.          Height          =   285
  134.          Left            =   0
  135.          TabIndex        =   9
  136.          Top             =   1080
  137.          Width           =   2895
  138.       End
  139.       Begin VB.TextBox txtDefaultValue 
  140.          Height          =   285
  141.          Left            =   0
  142.          TabIndex        =   10
  143.          Top             =   1440
  144.          Width           =   2895
  145.       End
  146.    End
  147.    Begin VB.PictureBox picFieldProps1 
  148.       Appearance      =   0  'Flat
  149.       BorderStyle     =   0  'None
  150.       Enabled         =   0   'False
  151.       ForeColor       =   &H80000008&
  152.       Height          =   1095
  153.       Left            =   4560
  154.       ScaleHeight     =   1095
  155.       ScaleWidth      =   3015
  156.       TabIndex        =   32
  157.       TabStop         =   0   'False
  158.       Top             =   840
  159.       Width           =   3015
  160.       Begin VB.TextBox txtCollatingOrder 
  161.          Enabled         =   0   'False
  162.          Height          =   285
  163.          Left            =   0
  164.          TabIndex        =   39
  165.          TabStop         =   0   'False
  166.          Top             =   720
  167.          Width           =   1095
  168.       End
  169.       Begin VB.CheckBox chkAutoInc 
  170.          Caption         =   "
  171.          Enabled         =   0   'False
  172.          Height          =   255
  173.          Left            =   1200
  174.          MaskColor       =   &H00000000&
  175.          TabIndex        =   37
  176.          TabStop         =   0   'False
  177.          Top             =   720
  178.          Width           =   1400
  179.       End
  180.       Begin VB.CheckBox chkVariable 
  181.          Caption         =   "
  182.          Enabled         =   0   'False
  183.          Height          =   255
  184.          Left            =   1200
  185.          MaskColor       =   &H00000000&
  186.          TabIndex        =   36
  187.          TabStop         =   0   'False
  188.          Top             =   360
  189.          Width           =   1400
  190.       End
  191.       Begin VB.CheckBox chkFixedField 
  192.          Caption         =   "
  193.          Enabled         =   0   'False
  194.          Height          =   255
  195.          Left            =   1200
  196.          MaskColor       =   &H00000000&
  197.          TabIndex        =   35
  198.          TabStop         =   0   'False
  199.          Top             =   0
  200.          Width           =   1400
  201.       End
  202.       Begin VB.TextBox txtFieldSize 
  203.          Enabled         =   0   'False
  204.          Height          =   285
  205.          Left            =   0
  206.          TabIndex        =   34
  207.          TabStop         =   0   'False
  208.          Top             =   360
  209.          Width           =   1095
  210.       End
  211.       Begin VB.ComboBox cboFieldType 
  212.          Enabled         =   0   'False
  213.          Height          =   300
  214.          ItemData        =   "TBLSTRU.frx":000C
  215.          Left            =   0
  216.          List            =   "TBLSTRU.frx":000E
  217.          Style           =   1  'Simple Combo
  218.          TabIndex        =   33
  219.          TabStop         =   0   'False
  220.          Top             =   0
  221.          Width           =   1095
  222.       End
  223.    End
  224.    Begin VB.TextBox txtIndexName 
  225.       Height          =   285
  226.       Left            =   4680
  227.       TabIndex        =   14
  228.       Top             =   3975
  229.       Width           =   2895
  230.    End
  231.    Begin VB.TextBox txtFieldName 
  232.       Height          =   285
  233.       Left            =   4560
  234.       Locked          =   -1  'True
  235.       TabIndex        =   4
  236.       Top             =   480
  237.       Width           =   2895
  238.    End
  239.    Begin VB.TextBox txtFields 
  240.       Height          =   285
  241.       Left            =   3960
  242.       TabIndex        =   15
  243.       TabStop         =   0   'False
  244.       Top             =   5055
  245.       Width           =   3615
  246.    End
  247.    Begin VB.ListBox lstIndexes 
  248.       Height          =   810
  249.       Left            =   120
  250.       TabIndex        =   11
  251.       Top             =   4215
  252.       Width           =   2895
  253.    End
  254.    Begin VB.CommandButton cmdAddTable 
  255.       Caption         =   "
  256. (&B)"
  257.       Enabled         =   0   'False
  258.       Height          =   375
  259.       HelpContextID   =   2016147
  260.       Left            =   240
  261.       MaskColor       =   &H00000000&
  262.       TabIndex        =   16
  263.       Top             =   5640
  264.       Visible         =   0   'False
  265.       Width           =   2295
  266.    End
  267.    Begin VB.CommandButton cmdClose 
  268.       Cancel          =   -1  'True
  269.       Caption         =   "
  270. (&C)"
  271.       Height          =   375
  272.       Left            =   2760
  273.       MaskColor       =   &H00000000&
  274.       TabIndex        =   17
  275.       Top             =   5640
  276.       Width           =   2175
  277.    End
  278.    Begin VB.CommandButton cmdPrint 
  279.       Caption         =   "
  280. (&P)"
  281.       Height          =   375
  282.       Left            =   5160
  283.       MaskColor       =   &H00000000&
  284.       TabIndex        =   18
  285.       Top             =   5640
  286.       Visible         =   0   'False
  287.       Width           =   2295
  288.    End
  289.    Begin VB.CommandButton cmdRemoveIndex 
  290.       Caption         =   "
  291. (&M)"
  292.       Height          =   375
  293.       Left            =   1560
  294.       MaskColor       =   &H00000000&
  295.       TabIndex        =   13
  296.       Top             =   5115
  297.       Width           =   1440
  298.    End
  299.    Begin VB.CommandButton cmdAddIndex 
  300.       Caption         =   "
  301. (&I)"
  302.       Height          =   375
  303.       Left            =   120
  304.       MaskColor       =   &H00000000&
  305.       TabIndex        =   12
  306.       Top             =   5115
  307.       Width           =   1440
  308.    End
  309.    Begin VB.ListBox lstFields 
  310.       Height          =   2610
  311.       Left            =   105
  312.       TabIndex        =   1
  313.       Top             =   720
  314.       Width           =   2895
  315.    End
  316.    Begin VB.CommandButton cmdAddField 
  317.       Caption         =   "
  318. (&A)"
  319.       Height          =   375
  320.       Left            =   120
  321.       MaskColor       =   &H00000000&
  322.       TabIndex        =   2
  323.       Top             =   3360
  324.       Width           =   1440
  325.    End
  326.    Begin VB.CommandButton cmdRemoveField 
  327.       Caption         =   "
  328. (&R)"
  329.       Height          =   375
  330.       Left            =   1560
  331.       MaskColor       =   &H00000000&
  332.       TabIndex        =   3
  333.       Top             =   3360
  334.       Width           =   1440
  335.    End
  336.    Begin VB.TextBox txtTableName 
  337.       BackColor       =   &H00FFFFFF&
  338.       Height          =   285
  339.       Left            =   1920
  340.       TabIndex        =   0
  341.       Top             =   120
  342.       Width           =   3135
  343.    End
  344.    Begin VB.Label lblLabels 
  345.       AutoSize        =   -1  'True
  346.       Caption         =   "
  347.       Height          =   195
  348.       Index           =   24
  349.       Left            =   3240
  350.       TabIndex        =   31
  351.       Top             =   3975
  352.       Width           =   510
  353.    End
  354.    Begin VB.Label lblLabels 
  355.       AutoSize        =   -1  'True
  356.       Caption         =   "
  357.       Height          =   195
  358.       Index           =   20
  359.       Left            =   3120
  360.       TabIndex        =   30
  361.       Top             =   480
  362.       Width           =   510
  363.    End
  364.    Begin VB.Label lblLabels 
  365.       AutoSize        =   -1  'True
  366.       Caption         =   "
  367.       Height          =   195
  368.       Index           =   23
  369.       Left            =   3240
  370.       TabIndex        =   29
  371.       Top             =   5055
  372.       Width           =   510
  373.    End
  374.    Begin VB.Label lblLabels 
  375.       AutoSize        =   -1  'True
  376.       Caption         =   "
  377.       Height          =   195
  378.       Index           =   10
  379.       Left            =   3120
  380.       TabIndex        =   28
  381.       Top             =   3435
  382.       Width           =   1020
  383.    End
  384.    Begin VB.Label lblLabels 
  385.       AutoSize        =   -1  'True
  386.       Caption         =   "
  387.       Height          =   195
  388.       Index           =   9
  389.       Left            =   3120
  390.       TabIndex        =   27
  391.       Top             =   3075
  392.       Width           =   1110
  393.    End
  394.    Begin VB.Label lblLabels 
  395.       AutoSize        =   -1  'True
  396.       Caption         =   "
  397.       Height          =   195
  398.       Index           =   8
  399.       Left            =   3120
  400.       TabIndex        =   26
  401.       Top             =   2715
  402.       Width           =   1125
  403.    End
  404.    Begin VB.Label lblLabels 
  405.       AutoSize        =   -1  'True
  406.       Caption         =   "
  407.       Height          =   195
  408.       Index           =   7
  409.       Left            =   3120
  410.       TabIndex        =   25
  411.       Top             =   2355
  412.       Width           =   1170
  413.    End
  414.    Begin VB.Label lblLabels 
  415.       AutoSize        =   -1  'True
  416.       Caption         =   "
  417.       Height          =   195
  418.       Index           =   5
  419.       Left            =   3120
  420.       TabIndex        =   24
  421.       Top             =   1200
  422.       Width           =   390
  423.    End
  424.    Begin VB.Label lblLabels 
  425.       AutoSize        =   -1  'True
  426.       Caption         =   "
  427.       Height          =   195
  428.       Index           =   4
  429.       Left            =   3120
  430.       TabIndex        =   23
  431.       Top             =   840
  432.       Width           =   465
  433.    End
  434.    Begin VB.Line Line1 
  435.       BorderWidth     =   3
  436.       X1              =   120
  437.       X2              =   7560
  438.       Y1              =   3840
  439.       Y2              =   3840
  440.    End
  441.    Begin VB.Label lblLabels 
  442.       AutoSize        =   -1  'True
  443.       Caption         =   "
  444.       Height          =   195
  445.       Index           =   22
  446.       Left            =   3120
  447.       TabIndex        =   22
  448.       Top             =   1560
  449.       Width           =   1140
  450.    End
  451.    Begin VB.Label lblLabels 
  452.       AutoSize        =   -1  'True
  453.       Caption         =   "
  454.       Height          =   195
  455.       Index           =   2
  456.       Left            =   120
  457.       TabIndex        =   21
  458.       Top             =   3975
  459.       Width           =   855
  460.    End
  461.    Begin VB.Label lblLabels 
  462.       AutoSize        =   -1  'True
  463.       Caption         =   "
  464.       Height          =   195
  465.       Index           =   1
  466.       Left            =   120
  467.       TabIndex        =   20
  468.       Top             =   480
  469.       Width           =   720
  470.    End
  471.    Begin VB.Label lblLabels 
  472.       AutoSize        =   -1  'True
  473.       Caption         =   "
  474.       Height          =   195
  475.       Index           =   0
  476.       Left            =   120
  477.       TabIndex        =   19
  478.       Top             =   120
  479.       Width           =   945
  480.    End
  481. Attribute VB_Name = "frmTblStruct"
  482. Attribute VB_GlobalNameSpace = False
  483. Attribute VB_Creatable = False
  484. Attribute VB_PredeclaredId = True
  485. Attribute VB_Exposed = False
  486. Option Explicit
  487. '>>>>>>>>>>>>>>>>>>>>>>>>
  488. Const FORMCAPTION = "
  489. Const BUTTON1 = "
  490. (&A)"
  491. Const BUTTON2 = "
  492. (&R)"
  493. Const BUTTON3 = "
  494. (&I)"
  495. Const BUTTON4 = "
  496. (&M)"
  497. Const BUTTON5 = "
  498. (&B)"
  499. Const BUTTON6 = "
  500. (&C)"
  501. Const BUTTON7 = "
  502. (&P)"
  503. Const Label1 = "
  504. Const Label2 = "
  505. Const LABEL3 = "
  506. Const MSG1 = "
  507. Const MSG2 = "
  508. Const MSG3 = "
  509. Const MSG4 = "
  510. Const MSG5 = "
  511. Const MSG6 = "
  512. Const MSG7 = "
  513. Const MSG8 = "
  514. '>>>>>>>>>>>>>>>>>>>>>>>>
  515. Dim msCurrField As String
  516. Dim mfldCurrFld As Field
  517. Dim msCurrIndex As String
  518. Dim mindCurrInd As Index
  519. Dim mnFldCount As Integer
  520. Dim mnIndCount As Integer
  521. Dim mbTableNameChanged As Boolean
  522. Sub cboFieldType_Change()
  523.   If mfldCurrFld.Type < 9 Then
  524.     cboFieldType.ListIndex = mfldCurrFld.Type - 1
  525.   Else
  526.     cboFieldType.ListIndex = mfldCurrFld.Type - 2
  527.   End If
  528. End Sub
  529. Sub cboFieldType_Click()
  530.   If cboFieldType.ListIndex = -1 Then Exit Sub
  531.   If mfldCurrFld.Type < 9 Then
  532.     cboFieldType.ListIndex = mfldCurrFld.Type - 1
  533.   Else
  534.     cboFieldType.ListIndex = mfldCurrFld.Type - 2
  535.   End If
  536. End Sub
  537. Private Sub chkAllowZeroLen_Click()
  538.   On Error GoTo AZErr
  539.   If mfldCurrFld Is Nothing Then Exit Sub
  540.   mfldCurrFld.AllowZeroLength = IIf(chkAllowZeroLen.Value = vbChecked, True, False)
  541.   Exit Sub
  542. AZErr:
  543.   ShowError
  544. End Sub
  545. Private Sub chkRequired_Click()
  546.   On Error GoTo RQErr
  547.   If mfldCurrFld Is Nothing Then Exit Sub
  548.   mfldCurrFld.Required = IIf(chkRequired.Value = vbChecked, True, False)
  549.   Exit Sub
  550. RQErr:
  551.   ShowError
  552. End Sub
  553. Private Sub cmdAddField_Click()
  554.   MsgBar MSG1, False
  555.   frmAddField.Show vbModal
  556.   MsgBar vbNullString, False
  557. End Sub
  558. Private Sub cmdAddIndex_Click()
  559.   MsgBar MSG2, False
  560.   frmAddIndex.Show vbModal
  561.   MsgBar vbNullString, False
  562. End Sub
  563. Private Sub cmdAddTable_Click()
  564.   On Error GoTo ATErr
  565.   Dim i As Integer
  566.   If DupeTableName(gtdfTableDef.Name) Then
  567.     Screen.MousePointer = vbDefault
  568.     Exit Sub
  569.   End If
  570.   Screen.MousePointer = vbHourglass
  571.   MsgBar MSG3, True
  572.   gdbCurrentDB.TableDefs.Append gtdfTableDef
  573.   RefreshTables Nothing
  574.   Screen.MousePointer = vbDefault
  575.   MsgBar vbNullString, False
  576.   Unload Me
  577.   Exit Sub
  578. ATErr:
  579.   ShowError
  580. End Sub
  581. Private Sub cmdClose_Click()
  582.   If mbTableNameChanged Then
  583.     RefreshTables Nothing
  584.   End If
  585.   If cmdAddTable.Visible And cmdAddTable.Enabled Then
  586.     If MsgBox(MSG8, vbYesNo + vbQuestion, Me.Caption) = vbYes Then
  587.       Unload Me
  588.       MsgBar vbNullString, False
  589.     End If
  590.   Else
  591.     Unload Me
  592.     MsgBar vbNullString, False
  593.   End If
  594. End Sub
  595. Sub lstFields_Click()
  596.   On Error GoTo FErr
  597.   If lstFields.ListIndex = -1 Then Exit Sub
  598.   msCurrField = lstFields.Text
  599.   Set mfldCurrFld = gtdfTableDef.Fields(msCurrField)
  600.  Access 
  601.   txtFieldName.Enabled = (gsDataType = gsMSACCESS)
  602.   txtValidationText.Enabled = (gsDataType = gsMSACCESS)
  603.   txtValidationRule.Enabled = (gsDataType = gsMSACCESS)
  604.   txtDefaultValue.Enabled = (gsDataType = gsMSACCESS)
  605.   chkRequired.Enabled = (gsDataType = gsMSACCESS)
  606.   chkAllowZeroLen.Enabled = (gsDataType = gsMSACCESS)
  607.   txtOrdinalPos.Enabled = (gsDataType = gsMSACCESS)
  608.   txtFieldName.Locked = False
  609.   txtFieldName.Text = mfldCurrFld.Name
  610.   txtOrdinalPos.Text = mfldCurrFld.OrdinalPosition
  611.   If mfldCurrFld.Type < 9 Then
  612.     cboFieldType.ListIndex = mfldCurrFld.Type - 1
  613.   Else
  614.     cboFieldType.ListIndex = mfldCurrFld.Type - 2
  615.   End If
  616.   txtFieldSize.Text = mfldCurrFld.Size
  617.   txtCollatingOrder.Text = mfldCurrFld.CollatingOrder
  618.   chkFixedField.Value = IIf((mfldCurrFld.Attributes And dbFixedField) = dbFixedField, 1, 0)
  619.   chkVariable.Value = IIf((mfldCurrFld.Attributes And dbVariableField) = dbVariableField, 1, 0)
  620.   chkAutoInc.Value = IIf((mfldCurrFld.Attributes And dbAutoIncrField) = dbAutoIncrField, 1, 0)
  621.   If gsDataType = gsMSACCESS Then
  622.     txtValidationText.Text = mfldCurrFld.ValidationText
  623.     txtValidationRule.Text = mfldCurrFld.ValidationRule
  624.     txtDefaultValue.Text = mfldCurrFld.DefaultValue
  625.     chkRequired.Value = IIf(mfldCurrFld.Required, 1, 0)
  626.     chkAllowZeroLen.Value = IIf(mfldCurrFld.AllowZeroLength, 1, 0)
  627.   End If
  628.   Exit Sub
  629. FErr:
  630.   ShowError
  631. End Sub
  632. Sub lstIndexes_Click()
  633.   On Error GoTo IErr
  634.   If lstIndexes.ListIndex = -1 Then Exit Sub
  635.   msCurrIndex = lstIndexes.Text
  636.   Set mindCurrInd = gtdfTableDef.Indexes(msCurrIndex)
  637.   txtIndexName.Text = mindCurrInd.Name
  638.   txtFields.Text = mindCurrInd.Fields
  639.   chkRequiredInd.Value = IIf(mindCurrInd.Required, 1, 0)
  640.   chkUnique.Value = IIf(mindCurrInd.Unique, 1, 0)
  641.   chkIgnoreNull.Value = IIf(mindCurrInd.IgnoreNulls, 1, 0)
  642.   If gsDataType = gsMSACCESS Then
  643.     chkPrimary.Value = IIf(mindCurrInd.Primary, 1, 0)
  644.     chkForeign.Value = IIf(mindCurrInd.Foreign, 1, 0)
  645.   End If
  646.   Exit Sub
  647. IErr:
  648.   ShowError
  649. End Sub
  650. Private Sub txtCollatingOrder_LostFocus()
  651.   If mfldCurrFld Is Nothing Then Exit Sub
  652.   txtCollatingOrder.Text = mfldCurrFld.CollatingOrder
  653. End Sub
  654. Private Sub txtDefaultValue_LostFocus()
  655.   On Error GoTo DVErr
  656.   If mfldCurrFld Is Nothing Then Exit Sub
  657.   If mfldCurrFld.DefaultValue <> txtDefaultValue.Text Then
  658.     If Len(txtDefaultValue.Text) > 0 Then
  659.       mfldCurrFld.DefaultValue = txtDefaultValue.Text
  660.     End If
  661.   End If
  662.   Exit Sub
  663. DVErr:
  664.   ShowError
  665. End Sub
  666. Private Sub txtFieldName_LostFocus()
  667.   On Error GoTo FNErr
  668.   Dim i As Integer
  669.   If mfldCurrFld Is Nothing Then Exit Sub
  670.   If mfldCurrFld.Name <> txtFieldName.Text Then
  671.     If Len(txtFieldName.Text) > 0 Then
  672.       For i = 0 To lstFields.ListCount - 1
  673.         If lstFields.List(i) = mfldCurrFld.Name Then
  674.           lstFields.RemoveItem i
  675.           lstFields.AddItem txtFieldName.Text, i
  676.           Exit For
  677.         End If
  678.       Next
  679.       mfldCurrFld.Name = txtFieldName.Text
  680.     End If
  681.   End If
  682.   Exit Sub
  683. FNErr:
  684.   ShowError
  685. End Sub
  686. Sub txtFields_LostFocus()
  687.   If mindCurrInd Is Nothing Then Exit Sub
  688.   txtFields.Text = mindCurrInd.Fields
  689. End Sub
  690. Private Sub txtFieldSize_LostFocus()
  691.   If mfldCurrFld Is Nothing Then Exit Sub
  692.   txtFieldSize.Text = mfldCurrFld.Size
  693. End Sub
  694. Private Sub txtIndexName_LostFocus()
  695.   On Error GoTo IDNErr
  696.   Dim i As Integer
  697.   If mindCurrInd Is Nothing Then Exit Sub
  698.   If mindCurrInd.Name <> txtIndexName.Text Then
  699.     If Len(txtIndexName.Text) > 0 And gsDataType = gsMSACCESS Then
  700.       For i = 0 To lstIndexes.ListCount - 1
  701.         If lstIndexes.List(i) = mindCurrInd.Name Then
  702.           lstIndexes.RemoveItem i
  703.           lstIndexes.AddItem txtIndexName.Text, i
  704.           Exit For
  705.         End If
  706.       Next
  707.       mindCurrInd.Name = txtIndexName.Text
  708.     End If
  709.   End If
  710.   Exit Sub
  711. IDNErr:
  712.   ShowError
  713. End Sub
  714. Private Sub txtOrdinalPos_LostFocus()
  715.   On Error GoTo OPErr
  716.   If mfldCurrFld Is Nothing Then Exit Sub
  717.   If mfldCurrFld.OrdinalPosition <> txtOrdinalPos.Text Then
  718.     If Len(txtFieldName.Text) > 0 And gsDataType = gsMSACCESS Then
  719.       mfldCurrFld.OrdinalPosition = txtOrdinalPos.Text
  720.     End If
  721.   End If
  722.   Exit Sub
  723. OPErr:
  724.   ShowError
  725. End Sub
  726. Private Sub txtTableName_Change()
  727.   If gbAddTableFlag Then
  728.     If Len(txtTableName.Text) > 0 And lstFields.ListCount > 0 Then
  729.       cmdAddTable.Enabled = True
  730.     Else
  731.       cmdAddTable.Enabled = False
  732.     End If
  733.     gtdfTableDef.Name = txtTableName.Text
  734.   End If
  735. End Sub
  736. Private Sub txtTableName_LostFocus()
  737.   On Error GoTo TBNErr
  738.   Dim i As Integer
  739.   If gtdfTableDef.Name <> txtTableName.Text Then
  740.     If Len(txtTableName.Text) > 0 And gsDataType = gsMSACCESS Then
  741.       '
  742.       gtdfTableDef.Name = txtTableName.Text
  743.       mbTableNameChanged = True
  744.     End If
  745.   End If
  746.   Exit Sub
  747. TBNErr:
  748.   ShowError
  749. End Sub
  750. Private Sub txtTableName_KeyPress(KeyAscii As Integer)
  751.   If txtTableName.TabStop = False Then
  752.     KeyAscii = 0   '
  753.   End If
  754. End Sub
  755. Private Sub cmdRemoveIndex_Click()
  756.   On Error GoTo DELErr
  757.   If lstIndexes.ListIndex < 0 Then Exit Sub
  758.   If MsgBox(MSG4, vbYesNo + vbQuestion) = vbYes Then
  759.     If gbAddTableFlag = False Then
  760.       gtdfTableDef.Indexes.Delete lstIndexes.Text
  761.     End If
  762.     '
  763.     lstIndexes.RemoveItem lstIndexes.ListIndex
  764.   End If
  765.   txtIndexName.Text = vbNullString
  766.   txtFields.Text = vbNullString
  767.   chkRequiredInd.Value = vbUnchecked
  768.   chkUnique.Value = vbUnchecked
  769.   chkIgnoreNull.Value = vbUnchecked
  770.   chkPrimary.Value = vbUnchecked
  771.   chkForeign.Value = vbUnchecked
  772.   Exit Sub
  773. DELErr:
  774.   ShowError
  775. End Sub
  776. Private Sub Form_Load()
  777.   On Error GoTo LoadErr
  778.   Dim fld As Field
  779.   Dim idx As Index
  780.   Me.Caption = FORMCAPTION
  781.   cmdAddField.Caption = BUTTON1
  782.   cmdRemoveField.Caption = BUTTON2
  783.   cmdAddIndex.Caption = BUTTON3
  784.   cmdRemoveIndex.Caption = BUTTON4
  785.   cmdAddTable.Caption = BUTTON5
  786.   cmdClose.Caption = BUTTON6
  787.   cmdPrint.Caption = BUTTON7
  788.   lblLabels(0).Caption = Label1
  789.   lblLabels(1).Caption = Label2
  790.   lblLabels(2).Caption = LABEL3
  791.   Screen.MousePointer = vbHourglass
  792.   MsgBar MSG5, True
  793.   cboFieldType.AddItem "Boolean"
  794.   cboFieldType.AddItem "Byte"
  795.   cboFieldType.AddItem "Integer"
  796.   cboFieldType.AddItem "Long"
  797.   cboFieldType.AddItem "Currency"
  798.   cboFieldType.AddItem "Single"
  799.   cboFieldType.AddItem "Double"
  800.   cboFieldType.AddItem "Date/Time"
  801.   cboFieldType.AddItem "Text"
  802.   cboFieldType.AddItem "Binary"
  803.   cboFieldType.AddItem "Memo"
  804.   If gbAddTableFlag Then
  805.     Set gtdfTableDef = gdbCurrentDB.CreateTableDef()
  806.     mnFldCount = 0
  807.     mnIndCount = 0
  808.     cmdAddTable.Visible = True
  809.   Else
  810.     cmdPrint.Visible = True
  811.     Set gtdfTableDef = gdbCurrentDB.TableDefs(StripConnect(gnodDBNode2.Text))
  812.     txtTableName.Text = gtdfTableDef.Name
  813.     ListItemNames gtdfTableDef.Fields, lstFields, False
  814.     mnFldCount = lstFields.ListCount
  815.     lstFields.ListIndex = 0
  816.     ListItemNames gtdfTableDef.Indexes, lstIndexes, False
  817.     mnIndCount = lstIndexes.ListCount
  818.     If mnIndCount > 0 Then lstIndexes.ListIndex = 0
  819.   End If
  820.   If gsDataType <> gsMSACCESS Then
  821.     '
  822.  mdb 
  823.     If gbAddTableFlag = False Then txtTableName.Locked = True
  824.     '
  825.  mdb 
  826.     If gbAddTableFlag = False Then cmdRemoveField.Enabled = False
  827.     '
  828.  mdb 
  829.     txtFieldName.Locked = True
  830.     chkRequired.Enabled = False
  831.     chkAllowZeroLen.Enabled = False
  832.     txtIndexName.Locked = True
  833.     txtFields.Locked = True
  834.   End If
  835.   Screen.MousePointer = vbDefault
  836.   MsgBar vbNullString, False
  837.   Exit Sub
  838. LoadErr:
  839.   ShowError
  840.   Unload Me
  841. End Sub
  842. Private Sub cmdPrint_Click()
  843.   On Error GoTo PRTErr
  844.   Dim i As Integer
  845.   Dim sTmp As String
  846.   MsgBar MSG6, True
  847.   Printer.Print
  848.   Printer.Print
  849.   Printer.Print
  850.   Printer.Print "
  851. " & gsDBName
  852.   Printer.Print
  853.   Printer.Print
  854.   Printer.Print txtTableName & "
  855.   Printer.Print
  856.   Printer.Print
  857.   Printer.Print "
  858.   Printer.Print String(60, "-")
  859.   For i = 0 To lstFields.ListCount - 1
  860.     lstFields.ListIndex = i
  861.     sTmp = txtFieldName.Text & " - "
  862.     sTmp = sTmp & cboFieldType.Text & " - "
  863.     sTmp = sTmp & txtFieldSize.Text
  864.     Printer.Print sTmp
  865.   Next
  866.   Printer.Print
  867.   Printer.Print
  868.   Printer.Print "
  869.   Printer.Print String(60, "-")
  870.   For i = 0 To lstIndexes.ListCount - 1
  871.     sTmp = txtIndexName.Text & " - "
  872.     sTmp = sTmp & txtFields.Text & " - "
  873.     sTmp = sTmp & IIf(chkUnique = 1, "True", "False")
  874.     Printer.Print sTmp
  875.   Next
  876.   Printer.NewPage
  877.   Printer.EndDoc
  878.   MsgBar vbNullString, False
  879.   Exit Sub
  880. PRTErr:
  881.   ShowError
  882. End Sub
  883. Private Sub cmdRemoveField_Click()
  884.   On Error GoTo RFErr
  885.   If lstFields.ListIndex < 0 Then Exit Sub
  886.   If MsgBox(MSG7, vbYesNo + vbQuestion) = vbYes Then
  887.     '
  888.     txtFieldName.Text = vbNullString
  889.     txtOrdinalPos.Text = vbNullString
  890.     cboFieldType.ListIndex = -1
  891.     cboFieldType.Text = vbNullString
  892.     txtFieldSize.Text = vbNullString
  893.     txtCollatingOrder.Text = vbNullString
  894.     chkFixedField.Value = vbUnchecked
  895.     chkVariable.Value = vbUnchecked
  896.     chkAutoInc.Value = vbUnchecked
  897.     txtValidationText.Text = vbNullString
  898.     txtValidationRule.Text = vbNullString
  899.     txtDefaultValue.Text = vbNullString
  900.     chkRequired.Value = vbUnchecked
  901.     chkAllowZeroLen.Value = vbUnchecked
  902.     '
  903.     gtdfTableDef.Fields.Delete lstFields.Text
  904.     '
  905.     lstFields.RemoveItem lstFields.ListIndex
  906.   End If
  907.   If lstFields.ListCount = 0 Then
  908.     '
  909. build
  910.     cmdAddTable.Enabled = False
  911.   End If
  912.   Exit Sub
  913. RFErr:
  914.   ShowError
  915. End Sub
  916. Private Sub txtValidationRule_LostFocus()
  917.   On Error GoTo VRErr
  918.   If mfldCurrFld Is Nothing Then Exit Sub
  919.   If mfldCurrFld.ValidationRule <> txtValidationRule.Text Then
  920.     If Len(txtValidationRule.Text) > 0 And gsDataType = gsMSACCESS Then
  921.       mfldCurrFld.ValidationRule = txtValidationRule.Text
  922.     End If
  923.   End If
  924.   Exit Sub
  925. VRErr:
  926.   ShowError
  927. End Sub
  928. Private Sub txtValidationText_LostFocus()
  929.   On Error GoTo VTErr
  930.   If mfldCurrFld Is Nothing Then Exit Sub
  931.   If mfldCurrFld.ValidationText <> txtValidationText.Text Then
  932.     If Len(txtValidationText.Text) > 0 And gsDataType = gsMSACCESS Then
  933.       mfldCurrFld.ValidationText = txtValidationText.Text
  934.     End If
  935.   End If
  936.   Exit Sub
  937. VTErr:
  938.   ShowError
  939. End Sub
  940.