home *** CD-ROM | disk | FTP | other *** search
/ Master 95 #1 / MASTER95_1.iso / microsof / vbasic4 / vb4-6.cab / attach.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-07-26  |  4.7 KB  |  170 lines

  1. VERSION 4.00
  2. Begin VB.Form frmAttachments 
  3.    Caption         =   "Attachments"
  4.    ClientHeight    =   2895
  5.    ClientLeft      =   5565
  6.    ClientTop       =   2175
  7.    ClientWidth     =   6075
  8.    Height          =   3300
  9.    HelpContextID   =   2016086
  10.    Icon            =   "ATTACH.frx":0000
  11.    Left            =   5505
  12.    LinkTopic       =   "Form1"
  13.    LockControls    =   -1  'True
  14.    MDIChild        =   -1  'True
  15.    ScaleHeight     =   2895
  16.    ScaleWidth      =   6075
  17.    Top             =   1830
  18.    Width           =   6195
  19.    Begin VB.PictureBox picButtons 
  20.       Align           =   2  'Align Bottom
  21.       Appearance      =   0  'Flat
  22.       BorderStyle     =   0  'None
  23.       ForeColor       =   &H80000008&
  24.       Height          =   405
  25.       Left            =   0
  26.       ScaleHeight     =   405
  27.       ScaleWidth      =   6075
  28.       TabIndex        =   0
  29.       Top             =   2490
  30.       Width           =   6075
  31.       Begin VB.CommandButton cmdNew 
  32.          Caption         =   "&New"
  33.          Height          =   330
  34.          Left            =   120
  35.          TabIndex        =   3
  36.          Top             =   45
  37.          Width           =   1815
  38.       End
  39.       Begin VB.CommandButton cmdReAttach 
  40.          Caption         =   "&ReAttach"
  41.          Height          =   330
  42.          Left            =   2160
  43.          TabIndex        =   2
  44.          Top             =   45
  45.          Width           =   1845
  46.       End
  47.       Begin VB.CommandButton cmdClose 
  48.          Caption         =   "&Close"
  49.          Height          =   330
  50.          Left            =   4200
  51.          TabIndex        =   1
  52.          Top             =   45
  53.          Width           =   1845
  54.       End
  55.    End
  56.    Begin MSGrid.Grid grdTables 
  57.       Height          =   2415
  58.       Left            =   0
  59.       TabIndex        =   4
  60.       Top             =   0
  61.       Width           =   6015
  62.       _version        =   65536
  63.       _extentx        =   10610
  64.       _extenty        =   4260
  65.       _stockprops     =   77
  66.       backcolor       =   16777215
  67.       cols            =   3
  68.    End
  69. Attribute VB_Name = "frmAttachments"
  70. Attribute VB_Creatable = False
  71. Attribute VB_Exposed = False
  72. Option Explicit
  73. Sub cmdClose_Click()
  74.   Unload Me
  75. End Sub
  76. Sub cmdNew_Click()
  77.   frmNewAttach.Show vbModal
  78. End Sub
  79. Sub cmdReAttach_Click()
  80.   On Error GoTo REAErr
  81.   Dim i As Integer
  82.   Dim sTmp As String
  83.   SetHourglass
  84.   'execute the refreshlink method on all the selected items
  85.   grdTables.Col = 0
  86.   For i = grdTables.SelStartRow To grdTables.SelEndRow
  87.     grdTables.Row = i
  88.     sTmp = grdTables.Text
  89.     gdbCurrentDB.TableDefs(sTmp).RefreshLink
  90.   Next
  91.   MsgBar gsNULL_STR, False
  92.   Screen.MousePointer = vbDefault
  93.   Exit Sub
  94. REAErr:
  95.   ShowError
  96.   If i > 0 Then
  97.     Resume Next    'try to continue
  98.   End If
  99.   Exit Sub
  100. End Sub
  101. Sub Form_Load()
  102.   On Error GoTo FLErr
  103.   Dim tdf As TableDef
  104.   Dim i As Integer
  105.   'center it on the MDI form
  106.   Me.Top = (frmMDI.Height - Me.Height) \ 2
  107.   Me.Left = (frmMDI.Width - Me.Width) \ 2
  108.   With grdTables
  109.     .Row = 0
  110.     .Col = 0
  111.     .Text = "Table"
  112.     .Col = 1
  113.     .Text = "SourceTable"
  114.     .Col = 2
  115.     .Text = "Connect"
  116.     .FixedRows = 1
  117.     .ColWidth(0) = 1500
  118.     .ColWidth(1) = 2000
  119.     .ColWidth(2) = .Width - 3600
  120.   End With
  121.   'get the attached tables from the tabledefs collection
  122.   For Each tdf In gdbCurrentDB.TableDefs
  123.     If (tdf.Attributes And dbAttachedTable) = dbAttachedTable Or _
  124.        (tdf.Attributes And dbAttachedODBC) = dbAttachedODBC Then
  125.       grdTables.AddItem tdf.Name & Chr(9) & tdf.SourceTableName & Chr(9) & tdf.Connect
  126.     End If
  127.   Next
  128.   'remove the first blank row if there are some entries
  129.   If grdTables.Rows > 2 Then
  130.     grdTables.RemoveItem 1
  131.   End If
  132.   Screen.MousePointer = vbDefault
  133.   Exit Sub
  134. FLErr:
  135.   ShowError
  136.   Unload Me
  137.   Exit Sub
  138. End Sub
  139. Private Sub grdTables_DblClick()
  140.   On Error GoTo GTDErr
  141.   SetHourglass
  142.   grdTables.Col = 0
  143.   gdbCurrentDB.TableDefs(grdTables.Text).RefreshLink
  144.   Screen.MousePointer = vbDefault
  145.   Exit Sub
  146. GTDErr:
  147.   ShowError
  148.   Exit Sub
  149. End Sub
  150. Sub grdTables_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  151.   On Error GoTo TMErr
  152.   Dim sTmp As String
  153.   If Button <> 2 Then Exit Sub
  154.   grdTables.Row = Y \ frmAttachments.grdTables.RowHeight(0)
  155.   grdTables.Col = 0
  156.   sTmp = grdTables.Text
  157.   ShowProperties "TableDef", gdbCurrentDB.TableDefs(sTmp)
  158.   Exit Sub
  159. TMErr:
  160.   ShowError
  161.   Exit Sub
  162. End Sub
  163. Private Sub Form_Resize()
  164.   On Error Resume Next
  165.   If Me.WindowState = 1 Then Exit Sub
  166.   grdTables.Width = Me.Width - 375
  167.   grdTables.Height = Me.Height - 970
  168.   grdTables.ColWidth(2) = grdTables.Width - 3600
  169. End Sub
  170.