home *** CD-ROM | disk | FTP | other *** search
/ On Hand / On_Hand_From_Softbank_1994_Release_2_Disc_2_1994.iso / 00202 / s / disk4 / cpystru.fr_ / cpystru.bin
Text File  |  1993-04-28  |  6KB  |  211 lines

  1. VERSION 2.00
  2. Begin Form fCpyStru 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "Copy Table(s)"
  6.    ClientHeight    =   3300
  7.    ClientLeft      =   2730
  8.    ClientTop       =   2235
  9.    ClientWidth     =   6525
  10.    ControlBox      =   0   'False
  11.    Height          =   3705
  12.    Left            =   2670
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    ScaleHeight     =   3278.104
  17.    ScaleMode       =   0  'User
  18.    ScaleWidth      =   6554.436
  19.    Top             =   1890
  20.    Width           =   6645
  21.    Begin CheckBox cCopyData 
  22.       BackColor       =   &H00C0C0C0&
  23.       Caption         =   "Copy Data"
  24.       Height          =   255
  25.       Left            =   3675
  26.       TabIndex        =   9
  27.       Top             =   2310
  28.       Value           =   1  'Checked
  29.       Width           =   1380
  30.    End
  31.    Begin TextBox cDataBase 
  32.       BackColor       =   &H00FFFFFF&
  33.       Height          =   285
  34.       Left            =   3045
  35.       TabIndex        =   1
  36.       Tag             =   "OL"
  37.       Top             =   420
  38.       Width           =   3375
  39.    End
  40.    Begin CommandButton CloseButton 
  41.       Cancel          =   -1  'True
  42.       Caption         =   "&Close"
  43.       Height          =   375
  44.       Left            =   4830
  45.       TabIndex        =   4
  46.       Top             =   2730
  47.       Width           =   1515
  48.    End
  49.    Begin CommandButton OkayButton 
  50.       Caption         =   "&OK"
  51.       Default         =   -1  'True
  52.       Height          =   375
  53.       Left            =   3045
  54.       TabIndex        =   3
  55.       Top             =   2730
  56.       Width           =   1485
  57.    End
  58.    Begin TextBox cConnect 
  59.       BackColor       =   &H00FFFFFF&
  60.       Height          =   540
  61.       Left            =   3045
  62.       MultiLine       =   -1  'True
  63.       TabIndex        =   0
  64.       Tag             =   "OL"
  65.       Top             =   1155
  66.       Width           =   3375
  67.    End
  68.    Begin CheckBox cCopyIndexes 
  69.       BackColor       =   &H00C0C0C0&
  70.       Caption         =   "Copy Indexes"
  71.       Height          =   255
  72.       Left            =   3675
  73.       TabIndex        =   2
  74.       Top             =   1890
  75.       Value           =   1  'Checked
  76.       Width           =   1605
  77.    End
  78.    Begin ListBox cTableList 
  79.       BackColor       =   &H00FFFFFF&
  80.       Height          =   2760
  81.       Left            =   105
  82.       MultiSelect     =   2  'Extended
  83.       Sorted          =   -1  'True
  84.       TabIndex        =   5
  85.       Tag             =   "OL"
  86.       Top             =   420
  87.       Width           =   2775
  88.    End
  89.    Begin Label ServerLabel 
  90.       BackColor       =   &H00C0C0C0&
  91.       Caption         =   "Target Connect String:"
  92.       Height          =   255
  93.       Left            =   3045
  94.       TabIndex        =   8
  95.       Top             =   840
  96.       Width           =   2115
  97.    End
  98.    Begin Label DataBaseLabel 
  99.       BackColor       =   &H00C0C0C0&
  100.       Caption         =   "Target Database:"
  101.       Height          =   225
  102.       Left            =   3045
  103.       TabIndex        =   7
  104.       Top             =   105
  105.       Width           =   1725
  106.    End
  107.    Begin Label TableListLabel 
  108.       BackColor       =   &H00C0C0C0&
  109.       Caption         =   "Tables:"
  110.       Height          =   225
  111.       Index           =   0
  112.       Left            =   105
  113.       TabIndex        =   6
  114.       Top             =   105
  115.       Width           =   2295
  116.    End
  117. End
  118.  
  119.  
  120. Option Explicit
  121.  
  122. Sub CloseButton_Click ()
  123.   RefreshTables fTables.cTableList, True  'just in case some were added
  124.   Unload Me
  125. End Sub
  126.  
  127. Sub Form_Load ()
  128.   Dim i As Integer
  129.  
  130.   RefreshTables cTableList, False
  131.   
  132.   cDataBase = gstDBName
  133.   cConnect = gCurrentDB.Connect
  134.   
  135.   Left = (Screen.Width - Width) / 2
  136.   Top = (Screen.Height - Height) / 2
  137. End Sub
  138.  
  139. Sub Form_Paint ()
  140.   Outlines Me
  141. End Sub
  142.  
  143. Sub OkayButton_Click ()
  144.   Dim i As Integer
  145.   Dim diff_db As Integer
  146.   Dim to_nm As String
  147.   Dim to_db As database
  148.   Dim Connect As String
  149.  
  150.   On Error GoTo OkayErr
  151.  
  152.   MsgBar "Copying Table(s)", True
  153.  
  154.   SetHourglass Me
  155.   If cDataBase = "" Or cDataBase = gstDBName Then
  156.     Set to_db = gCurrentDB
  157.     diff_db = False
  158.   Else
  159.     Set to_db = OpenDatabase(cDataBase, False, False, cConnect + ";LoginTimeout=" & glLoginTimeout)
  160.     to_db.QueryTimeout = glQueryTimeout
  161.     diff_db = True
  162.   End If
  163.  
  164.   For i = 0 To cTableList.ListCount - 1
  165.     If cTableList.Selected(i) Then
  166.       If diff_db = False Then
  167.         to_nm = InputBox("Enter New Table Name:")
  168.  
  169.         If to_nm = "" Then GoTo skipit
  170.       Else
  171.         to_nm = (cTableList.List(i))
  172.       End If
  173.     Else
  174.       GoTo skipit
  175.     End If
  176.  
  177.     SetHourglass Me
  178.     If CopyStruct(gCurrentDB, to_db, (cTableList.List(i)), to_nm, (cCopyIndexes)) = True Then
  179.       If cCopyData = 1 Then
  180.         If CopyData(gCurrentDB, to_db, (cTableList.List(i)), to_nm) = False Then
  181.           Beep
  182.           MsgBox "Copy of Data To " + (cTableList.List(i)) + " was UnSuccessful!"
  183.         End If
  184.       End If
  185.       ResetMouse Me
  186.       MsgBox "Copy of " + (cTableList.List(i)) + " Structure was Successful!"
  187.       cTableList.Selected(i) = False
  188.     Else
  189.       ResetMouse Me
  190.       Beep
  191.       MsgBox "Copy of " + (cTableList.List(i)) + " UnSuccessful!"
  192.     End If
  193.  
  194.  
  195. skipit:
  196.  
  197.   Next
  198.  
  199.   GoTo OkayEnd
  200.  
  201. OkayErr:
  202.   ShowError
  203.   Resume OkayEnd
  204.  
  205. OkayEnd:
  206.   On Error Resume Next
  207.   MsgBar "", False
  208.  
  209. End Sub
  210.  
  211.