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

  1. VERSION 5.00
  2. Begin VB.Form frmJoin 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "
  5.    ClientHeight    =   2025
  6.    ClientLeft      =   1125
  7.    ClientTop       =   1560
  8.    ClientWidth     =   5910
  9.    HelpContextID   =   2016131
  10.    Icon            =   "JOIN.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    LockControls    =   -1  'True
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   2025
  16.    ScaleWidth      =   5910
  17.    ShowInTaskbar   =   0   'False
  18.    StartUpPosition =   1  'CenterOwner
  19.    Begin VB.CommandButton cmdClearJoins 
  20.       Caption         =   "
  21. (&L)"
  22.       Height          =   372
  23.       Left            =   2040
  24.       MaskColor       =   &H00000000&
  25.       TabIndex        =   7
  26.       Top             =   1560
  27.       Width           =   1812
  28.    End
  29.    Begin VB.CommandButton cmdClose 
  30.       Cancel          =   -1  'True
  31.       Caption         =   "
  32. (&C)"
  33.       Height          =   372
  34.       Left            =   3960
  35.       MaskColor       =   &H00000000&
  36.       TabIndex        =   6
  37.       Top             =   1560
  38.       Width           =   1812
  39.    End
  40.    Begin VB.ListBox lstFields2 
  41.       BackColor       =   &H00FFFFFF&
  42.       Height          =   990
  43.       Left            =   3960
  44.       TabIndex        =   4
  45.       Top             =   300
  46.       Width           =   1815
  47.    End
  48.    Begin VB.ListBox lstFields1 
  49.       BackColor       =   &H00FFFFFF&
  50.       Height          =   990
  51.       Left            =   2040
  52.       TabIndex        =   3
  53.       Top             =   300
  54.       Width           =   1815
  55.    End
  56.    Begin VB.CommandButton cmdAddJoin 
  57.       Caption         =   "
  58. (&A)"
  59.       Enabled         =   0   'False
  60.       Height          =   372
  61.       Left            =   120
  62.       MaskColor       =   &H00000000&
  63.       TabIndex        =   1
  64.       Top             =   1560
  65.       Width           =   1812
  66.    End
  67.    Begin VB.ListBox lstTables 
  68.       BackColor       =   &H00FFFFFF&
  69.       Height          =   990
  70.       Left            =   120
  71.       MultiSelect     =   1  'Simple
  72.       TabIndex        =   0
  73.       Top             =   300
  74.       Width           =   1815
  75.    End
  76.    Begin VB.Label lblLabels 
  77.       Alignment       =   2  'Center
  78.       Caption         =   "
  79.       Height          =   195
  80.       Index           =   1
  81.       Left            =   2040
  82.       TabIndex        =   5
  83.       Top             =   45
  84.       Width           =   3735
  85.    End
  86.    Begin VB.Label lblLabels 
  87.       AutoSize        =   -1  'True
  88.       Caption         =   "
  89.       Height          =   195
  90.       Index           =   0
  91.       Left            =   120
  92.       TabIndex        =   2
  93.       Top             =   45
  94.       Width           =   1290
  95.    End
  96. Attribute VB_Name = "frmJoin"
  97. Attribute VB_GlobalNameSpace = False
  98. Attribute VB_Creatable = False
  99. Attribute VB_PredeclaredId = True
  100. Attribute VB_Exposed = False
  101. Option Explicit
  102. '>>>>>>>>>>>>>>>>>>>>>>>>
  103. Const FORMCAPTION = "
  104. Const Label1 = "
  105. Const Label2 = "
  106. Const BUTTON1 = "
  107. (&A)"
  108. Const BUTTON2 = "
  109. (&L)"
  110. Const BUTTON3 = "
  111. (&C)"
  112. '>>>>>>>>>>>>>>>>>>>>>>>>
  113. Dim mtblTable1 As String
  114. Dim mtblTable2 As String
  115. Private Sub cmdAddJoin_Click()
  116.   Dim i As Integer
  117.   frmQuery.lstJoinFields.AddItem mtblTable1 & "." & lstFields1 & "=" & mtblTable2 & "." & lstFields2
  118.   For i = 0 To lstTables.ListCount - 1
  119.     lstTables.Selected(i) = False
  120.   Next
  121. End Sub
  122. Private Sub lstFields1_Click()
  123.   cmdAddJoin.Enabled = Len(lstFields2.Text) > 0
  124. End Sub
  125. Private Sub lstFields2_Click()
  126.   cmdAddJoin.Enabled = Len(lstFields1.Text) > 0
  127. End Sub
  128. Private Sub cmdClearJoins_Click()
  129.   frmQuery.lstJoinFields.Clear
  130. End Sub
  131. Private Sub cmdClose_Click()
  132.   Unload Me
  133. End Sub
  134. Private Sub lstTables_Click()
  135.   Dim i As Integer
  136.   Dim tblTableDefObj As TableDef
  137.   Dim fld As Field
  138.   mtblTable1 = vbNullString
  139.   mtblTable2 = vbNullString
  140.   For i = 0 To lstTables.ListCount - 1
  141.     If lstTables.Selected(i) Then
  142.       If Len(mtblTable1) = 0 Then
  143.         mtblTable1 = lstTables.List(i)
  144.       Else
  145.         mtblTable2 = lstTables.List(i)
  146.         Exit For
  147.       End If
  148.     End If
  149.   Next
  150.   If Len(mtblTable2) = 0 Then Exit Sub   '
  151.   Set tblTableDefObj = gdbCurrentDB.TableDefs(mtblTable1)
  152.   ListItemNames tblTableDefObj.Fields, lstFields1, True
  153.   Set tblTableDefObj = gdbCurrentDB.TableDefs(mtblTable2)
  154.   ListItemNames tblTableDefObj.Fields, lstFields2, True
  155. End Sub
  156. Private Sub Form_Load()
  157.   Dim i As Integer
  158.   Me.Caption = FORMCAPTION
  159.   lblLabels(0).Caption = Label1
  160.   lblLabels(1).Caption = Label2
  161.   cmdAddJoin.Caption = BUTTON1
  162.   cmdClearJoins.Caption = BUTTON2
  163.   cmdClose.Caption = BUTTON3
  164.   For i = 0 To frmQuery.lstTables.ListCount - 1
  165.     If frmQuery.lstTables.Selected(i) Then
  166.       lstTables.AddItem frmQuery.lstTables.List(i)
  167.     End If
  168.   Next
  169.   Me.Top = frmMDI.Top + frmQuery.Top + frmQuery.txtCriteria.Top + 1300
  170.   Me.Left = frmQuery.Left + 1500
  171. End Sub
  172.