home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l405 / 4.ddi / CPYSTRU.FR_ / CPYSTRU.bin (.txt)
Encoding:
Visual Basic Form  |  1993-04-28  |  5.4 KB  |  187 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. Option Explicit
  118. Sub CloseButton_Click ()
  119.   RefreshTables fTables.cTableList, True  'just in case some were added
  120.   Unload Me
  121. End Sub
  122. Sub Form_Load ()
  123.   Dim i As Integer
  124.   RefreshTables cTableList, False
  125.   cDataBase = gstDBName
  126.   cConnect = gCurrentDB.Connect
  127.   Left = (Screen.Width - Width) / 2
  128.   Top = (Screen.Height - Height) / 2
  129. End Sub
  130. Sub Form_Paint ()
  131.   Outlines Me
  132. End Sub
  133. Sub OkayButton_Click ()
  134.   Dim i As Integer
  135.   Dim diff_db As Integer
  136.   Dim to_nm As String
  137.   Dim to_db As database
  138.   Dim Connect As String
  139.   On Error GoTo OkayErr
  140.   MsgBar "Copying Table(s)", True
  141.   SetHourglass Me
  142.   If cDataBase = "" Or cDataBase = gstDBName Then
  143.     Set to_db = gCurrentDB
  144.     diff_db = False
  145.   Else
  146.     Set to_db = OpenDatabase(cDataBase, False, False, cConnect + ";LoginTimeout=" & glLoginTimeout)
  147.     to_db.QueryTimeout = glQueryTimeout
  148.     diff_db = True
  149.   End If
  150.   For i = 0 To cTableList.ListCount - 1
  151.     If cTableList.Selected(i) Then
  152.       If diff_db = False Then
  153.         to_nm = InputBox("Enter New Table Name:")
  154.         If to_nm = "" Then GoTo skipit
  155.       Else
  156.         to_nm = (cTableList.List(i))
  157.       End If
  158.     Else
  159.       GoTo skipit
  160.     End If
  161.     SetHourglass Me
  162.     If CopyStruct(gCurrentDB, to_db, (cTableList.List(i)), to_nm, (cCopyIndexes)) = True Then
  163.       If cCopyData = 1 Then
  164.         If CopyData(gCurrentDB, to_db, (cTableList.List(i)), to_nm) = False Then
  165.           Beep
  166.           MsgBox "Copy of Data To " + (cTableList.List(i)) + " was UnSuccessful!"
  167.         End If
  168.       End If
  169.       ResetMouse Me
  170.       MsgBox "Copy of " + (cTableList.List(i)) + " Structure was Successful!"
  171.       cTableList.Selected(i) = False
  172.     Else
  173.       ResetMouse Me
  174.       Beep
  175.       MsgBox "Copy of " + (cTableList.List(i)) + " UnSuccessful!"
  176.     End If
  177. skipit:
  178.   Next
  179.   GoTo OkayEnd
  180. OkayErr:
  181.   ShowError
  182.   Resume OkayEnd
  183. OkayEnd:
  184.   On Error Resume Next
  185.   MsgBar "", False
  186. End Sub
  187.