home *** CD-ROM | disk | FTP | other *** search
/ Internet Publisher's Toolbox 1.0 / Image.iso / toolbox / httpdsrv / vbs31src / tables.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-06-13  |  5.9 KB  |  211 lines

  1. VERSION 2.00
  2. Begin Form fTables 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "<none>"
  5.    ClientHeight    =   3255
  6.    ClientLeft      =   510
  7.    ClientTop       =   1575
  8.    ClientWidth     =   3000
  9.    Height          =   3660
  10.    Icon            =   TABLES.FRX:0000
  11.    Left            =   450
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    MDIChild        =   -1  'True
  15.    ScaleHeight     =   3235.273
  16.    ScaleMode       =   0  'User
  17.    ScaleWidth      =   3020.896
  18.    Top             =   1230
  19.    Width           =   3120
  20.    Begin CommandButton NewTableButton 
  21.       Caption         =   "&New"
  22.       Height          =   375
  23.       Left            =   120
  24.       TabIndex        =   4
  25.       Top             =   120
  26.       Width           =   855
  27.    End
  28.    Begin CommandButton StructButton 
  29.       Caption         =   "&Design"
  30.       Height          =   375
  31.       Left            =   2040
  32.       TabIndex        =   2
  33.       Top             =   120
  34.       Width           =   855
  35.    End
  36.    Begin CommandButton OpenButton 
  37.       Caption         =   "&Open"
  38.       Height          =   375
  39.       Left            =   1080
  40.       TabIndex        =   1
  41.       Top             =   120
  42.       Width           =   855
  43.    End
  44.    Begin ListBox cTableList 
  45.       BackColor       =   &H00FFFFFF&
  46.       Height          =   2175
  47.       Left            =   120
  48.       Sorted          =   -1  'True
  49.       TabIndex        =   0
  50.       Tag             =   "OL"
  51.       Top             =   855
  52.       Width           =   2775
  53.    End
  54.    Begin Label TableListLabel 
  55.       BackColor       =   &H00C0C0C0&
  56.       Caption         =   "Tables:"
  57.       Height          =   255
  58.       Left            =   120
  59.       TabIndex        =   3
  60.       Top             =   584
  61.       Width           =   2775
  62.    End
  63. '   rbd - Add feature to immediately display SQL if list item clicked
  64. '         is a query and "display SQL" is enabled. Also, clear the
  65. '         SQL window if table is not a query.
  66. Option Explicit
  67. Sub cTableList_Click ()
  68.   On Error Resume Next
  69.   Dim qd As QueryDef
  70.   Dim iTableType As Integer
  71.   iTableType = TableType((cTableList))
  72.   'check to see if the selected table is
  73.   'actually a querydef in an Access database
  74.   'and display the SQL if pref is set.
  75.   '(rbd) If not a querydef, then CLEAR the SQL
  76.   If gstDataType = "MS Access" Then
  77.     If iTableType = DB_QUERYDEF Then
  78.       Set qd = gCurrentDB.OpenQueryDef(cTableList)
  79.       If VDMDI.PrefDisplaySQL.Checked = True Then
  80.         fSql.cSQLStatement = qd.SQL
  81.       End If
  82.       qd.Close
  83.     Else
  84.         fSql.cSQLStatement = ""
  85.     End If
  86.   End If
  87. End Sub
  88. Sub cTableList_DblClick ()
  89.   gfFromSQL = False
  90.   Call OpenButton_Click
  91. End Sub
  92. Sub Form_Load ()
  93.   If gfDBOpenFlag = True Then
  94.     Caption = gstDBName + "." + gstDataBase
  95.   End If
  96.   'set the height and width
  97.   Height = 3870
  98.   Width = 3156
  99.   Top = 0
  100.   Left = 0
  101. End Sub
  102. Sub Form_Paint ()
  103.   Outlines Me
  104. End Sub
  105. Sub Form_Resize ()
  106.   On Error Resume Next
  107.   If WindowState <> 1 Then
  108.     cTableList.Height = Height - 1350
  109.     cTableList.Width = Width - 320
  110.     Outlines Me
  111.     Me.Refresh
  112.   End If
  113. End Sub
  114. Sub Form_Unload (Cancel As Integer)
  115.   Me.WindowState = 1
  116.   Cancel = True
  117. End Sub
  118. Sub NewTableButton_Click ()
  119.   If gfDBOpenFlag = False Then
  120.     MsgBox "No DataBase Open", 48
  121.     Exit Sub
  122.   End If
  123.   gfAddTableFlag = True
  124.   fTblStru.Show MODAL
  125. End Sub
  126. Sub OpenButton_Click ()
  127.   On Error Resume Next
  128.   Dim qd As QueryDef
  129.   Dim iTableType As Integer
  130.   Dim ActionQuery As String
  131.   If cTableList = "" Then
  132.     MsgBox "No Table Selected", 48
  133.     Exit Sub
  134.   End If
  135.   gfFromSQL = False
  136.   SetHourglass Me
  137.   iTableType = TableType((cTableList))
  138.   'check to see if the selected table is
  139.   'actually a querydef in an Access database
  140.   'and display the SQL if pref is set
  141.   If gstDataType = "MS Access" Then
  142.     If iTableType = DB_QUERYDEF Then
  143.       Set qd = gCurrentDB.OpenQueryDef(cTableList)
  144.       ActionQuery = ActionQueryType((cTableList))
  145.       If VDMDI.PrefDisplaySQL.Checked = True Then
  146.         fSql.cSQLStatement = qd.SQL
  147.       End If
  148.     End If
  149.   End If
  150.   'create a new dynaset form
  151.   gstDynaString = ""
  152.   If VDMDI.cSingleRecord = True Then
  153.     If iTableType = DB_QUERYDEF Then
  154.       If ActionQuery = "" Then
  155.         MsgBar "Opening Query Dynaset", True
  156.         Dim dsform1 As New fDynaset
  157.         dsform1.Show
  158.       Else
  159.         ResetMouse Me
  160.         If MsgBox("Run " + ActionQuery + " Query?", MSGBOX_TYPE) = YES Then
  161.           SetHourglass Me
  162.           MsgBar "Executing " + ActionQuery + " Query", True
  163.           qd.Execute
  164.         End If
  165.       End If
  166.     ElseIf iTableType = DB_ATTACHEDTABLE Then
  167.       MsgBar "Opening Dynaset on Attached Table", True
  168.       Dim dsform2 As New fDynaset
  169.       dsform2.Show
  170.     ElseIf iTableType = DB_ATTACHEDODBC Then
  171.       MsgBar "Opening Dynaset on Attached ODBC Table", True
  172.       Dim dsform3 As New fDynaset
  173.       dsform3.Show
  174.     ElseIf gstDataType = "ODBC" Then
  175.       MsgBar "Opening Dynaset on ODBC Table", True
  176.       Dim dsform4 As New fDynaset
  177.       dsform4.Show
  178.     Else
  179.       MsgBar "Opening Table", True
  180.       Dim tblform As New fTableObj
  181.       tblform.Show
  182.     End If
  183.   ElseIf ActionQuery <> "" Then
  184.     ResetMouse Me
  185.     Beep
  186.     MsgBox "Action Query Not Allowed w/ Data Control or Grid!", 16
  187.   ElseIf VDMDI.cDataCtl = True Then
  188.     MsgBar "Opening Full Table Dynaset w/ Data Control", True
  189.     Dim dsform5 As New fDataForm
  190.     dsform5.Show
  191.   Else
  192.     MsgBar "Opening Full Table Dynaset in Grid", True
  193.     Dim dsgrid As New fGridFrm
  194.     dsgrid.Show
  195.   End If
  196.   ResetMouse Me
  197.   MsgBar "", False
  198. End Sub
  199. Sub StructButton_Click ()
  200.   On Error Resume Next
  201.   If cTableList = "" Then
  202.     MsgBox "No Table Selected", 48
  203.     Exit Sub
  204.   End If
  205.   gfAddTableFlag = False
  206.   fTblStru.Show MODAL
  207. End Sub
  208. Sub TableListLabel_DblClick ()
  209.    RefreshTables cTableList, True
  210. End Sub
  211.