home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / bp_6_93 / bonus / dmsrc / dbform.txt < prev    next >
Text File  |  1995-02-26  |  3KB  |  112 lines

  1. Option Explicit
  2.  
  3. Sub Command1_Click ()
  4.  
  5.     OpenNewTableDesign
  6.  
  7. End Sub
  8.  
  9. Sub Command2_Click ()
  10.     Dim x As Integer
  11.  
  12.     On Error Resume Next
  13.  
  14.     If list1.ListIndex = -1 Then
  15.         MsgBox "No Table Selected:  You must select a table before it can be deleted", 64, "Data Manager"
  16.     Else
  17.         x = MsgBox("Are You Sure You Want To Delete Table:  """ + list1.List(list1.ListIndex) + """?", 33, "Data Manager")
  18.         If x = 1 Then
  19.             gDatabase.TableDefs.Delete list1.List(list1.ListIndex)
  20.             If Err <> 0 Then
  21.                 MsgBox "Could Not Delete Table:" + Chr$(13) + Error$, 64, "Data Manager"
  22.                 Exit Sub
  23.             Else
  24.                 RefreshDatabaseWindow
  25.             End If
  26.         End If
  27.     End If
  28. End Sub
  29.  
  30. Sub Command3_Click ()
  31.     On Error Resume Next 'catch case where form doesn't load
  32.     If list1.ListIndex <> -1 Then
  33.         MainForm.TableName = list1.List(list1.ListIndex)
  34.         Dim x As New DataForm
  35.         x.Show
  36.         If Err Then Exit Sub
  37.     Else
  38.         MsgBox "No Table Selected", 64, "Data Manager"
  39.     End If
  40.     
  41.  
  42. End Sub
  43.  
  44. Sub command4_click ()
  45.     
  46.     If list1.ListIndex <> -1 Then
  47.         If Not OpenTableDesign((list1.List(list1.ListIndex))) Then
  48.             MsgBox "Could Not Open Table Design Window.", 64, "Data Manager"
  49.         End If
  50.     Else
  51.         MsgBox "No Table Selected", 64, "Data Manager"
  52.     End If
  53.  
  54. End Sub
  55.  
  56. Sub Form_Load ()
  57.  
  58.     Me.Tag = "Database"
  59.     Left = 0
  60.     Top = 0
  61. End Sub
  62.  
  63. Sub Form_Resize ()
  64.     On Error Resume Next
  65.     Dim i As Integer
  66.     If Me.WindowState = 0 Then
  67.         If Me.Width < 2000 Then
  68.             Me.Width = 2000
  69.         End If
  70.         If Me.Height < 2070 Then
  71.             Me.Height = 2070
  72.         End If
  73.     End If
  74.  
  75.     If Me.WindowState <> 1 Then
  76.         list1.Width = Me.ScaleWidth - 120 - list1.Left
  77.         list1.Height = Me.ScaleHeight - 120 - list1.Top
  78.     End If
  79. End Sub
  80.  
  81. Sub Form_Unload (Cancel As Integer)
  82.  
  83.     Dim max As Integer
  84.     Dim i As Integer
  85.     Dim abort As Integer
  86.     Dim temp As Integer
  87.  
  88.     gDatabase.Close
  89.     gDatabaseName = ""
  90.     max = forms.Count - 1
  91.     i = 0
  92.     abort = False
  93.     Do While i <= max
  94.         If forms(i).Tag <> "Main" And forms(i).Tag <> "Database" Then
  95.             temp = forms.Count
  96.             Unload forms(i)
  97.             If temp = forms.Count Then
  98.                 abort = True
  99.                 Exit Do
  100.             End If
  101.             max = max - 1
  102.         Else
  103.             i = i + 1
  104.         End If
  105.     Loop
  106. End Sub
  107.  
  108. Sub List1_DblClick ()
  109.     command4_click
  110. End Sub
  111.  
  112.