home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l406 / 4.ddi / JOIN.FR_ / JOIN.bin (.txt)
Encoding:
Visual Basic Form  |  1992-10-21  |  3.9 KB  |  142 lines

  1. VERSION 2.00
  2. Begin Form fJoin 
  3.    BorderStyle     =   3  'Fixed Double
  4.    Caption         =   "Join Tables"
  5.    Height          =   2340
  6.    Left            =   3450
  7.    LinkTopic       =   "Form1"
  8.    ScaleHeight     =   1935
  9.    ScaleWidth      =   5835
  10.    Top             =   1590
  11.    Width           =   5955
  12.    Begin CommandButton ClearJoinsButton 
  13.       Caption         =   "C&lear All Joins"
  14.       Height          =   372
  15.       Left            =   2040
  16.       TabIndex        =   7
  17.       Top             =   1440
  18.       Width           =   1812
  19.    End
  20.    Begin CommandButton CloseButton 
  21.       Cancel          =   -1  'True
  22.       Caption         =   "&Close"
  23.       Height          =   372
  24.       Left            =   3960
  25.       TabIndex        =   6
  26.       Top             =   1440
  27.       Width           =   1812
  28.    End
  29.    Begin ListBox cFieldList2 
  30.       Height          =   1200
  31.       Left            =   3960
  32.       TabIndex        =   4
  33.       Top             =   240
  34.       Width           =   1815
  35.    End
  36.    Begin ListBox cFieldList1 
  37.       Height          =   1200
  38.       Left            =   2040
  39.       TabIndex        =   3
  40.       Top             =   240
  41.       Width           =   1815
  42.    End
  43.    Begin CommandButton AddJoinButton 
  44.       Caption         =   "&Add Join to Query"
  45.       Enabled         =   0   'False
  46.       Height          =   372
  47.       Left            =   120
  48.       TabIndex        =   1
  49.       Top             =   1440
  50.       Width           =   1812
  51.    End
  52.    Begin ListBox cTableList 
  53.       Height          =   1200
  54.       Left            =   120
  55.       MultiSelect     =   1  'Simple
  56.       TabIndex        =   0
  57.       Top             =   240
  58.       Width           =   1815
  59.    End
  60.    Begin Label FieldsLabel 
  61.       Alignment       =   2  'Center
  62.       Caption         =   "Select Fields to Join Selected Tables on:"
  63.       Height          =   252
  64.       Left            =   2040
  65.       TabIndex        =   5
  66.       Top             =   0
  67.       Width           =   3732
  68.    End
  69.    Begin Label TableListLabel 
  70.       Caption         =   "Select Table Pair:"
  71.       Height          =   252
  72.       Left            =   120
  73.       TabIndex        =   2
  74.       Top             =   0
  75.       Width           =   1812
  76.    End
  77. Option Explicit
  78. Dim FTbl1 As String
  79. Dim FTbl2 As String
  80. Sub AddJoinButton_Click ()
  81.   Dim i As Integer
  82.   fQuery.cJoinFields.AddItem FTbl1 + "." + cFieldList1 + "=" + FTbl2 + "." + cFieldList2
  83.   For i = 0 To cTableList.ListCount - 1
  84.     cTableList.Selected(i) = False
  85.   Next
  86. End Sub
  87. Sub cFieldList1_Click ()
  88.   If cFieldList2 <> "" Then
  89.     AddJoinButton.Enabled = True
  90.   End If
  91. End Sub
  92. Sub cFieldList2_Click ()
  93.   If cFieldList1 <> "" Then
  94.     AddJoinButton.Enabled = True
  95.   End If
  96. End Sub
  97. Sub ClearJoinsButton_Click ()
  98.   fQuery.cJoinFields.Clear
  99. End Sub
  100. Sub CloseButton_Click ()
  101.   Unload Me
  102. End Sub
  103. Sub cTableList_Click ()
  104.   Dim i As Integer
  105.   Dim t As TableDef
  106.   FTbl1 = ""
  107.   FTbl2 = ""
  108.   cFieldList1.Clear
  109.   cFieldList2.Clear
  110.   For i = 0 To cTableList.ListCount - 1
  111.     If cTableList.Selected(i) Then
  112.       If FTbl1 = "" Then
  113.         FTbl1 = cTableList.List(i)
  114.       Else
  115.         FTbl2 = cTableList.List(i)
  116.         Exit For
  117.       End If
  118.     End If
  119.   Next
  120.   If FTbl2 = "" Then Exit Sub   'only one table selected
  121.   Set t = gCurrentDB.TableDefs(FTbl1)
  122.   t.Fields.Refresh
  123.   For i = 0 To t.Fields.Count - 1
  124.     cFieldList1.AddItem t.Fields(i).Name
  125.   Next
  126.   Set t = gCurrentDB.TableDefs(FTbl2)
  127.   t.Fields.Refresh
  128.   For i = 0 To t.Fields.Count - 1
  129.     cFieldList2.AddItem t.Fields(i).Name
  130.   Next
  131. End Sub
  132. Sub Form_Load ()
  133.   Dim i As Integer
  134.   For i = 0 To fQuery.cTableList.ListCount - 1
  135.     If fQuery.cTableList.Selected(i) Then
  136.       cTableList.AddItem fQuery.cTableList.List(i)
  137.     End If
  138.   Next
  139.   Top = VDMDI.Top + fQuery.Top + fQuery.cCriteria.Top + 1300
  140.   Left = fQuery.Left + 1500
  141. End Sub
  142.