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

  1. VERSION 4.00
  2. Begin VB.Form frmCopyStruct 
  3.    BorderStyle     =   3  'Fixed Double
  4.    Caption         =   "Copy Table(s)"
  5.    ClientHeight    =   3300
  6.    ClientLeft      =   1380
  7.    ClientTop       =   1650
  8.    ClientWidth     =   6525
  9.    Height          =   3705
  10.    HelpContextID   =   2016121
  11.    Icon            =   "CPYSTRU.frx":0000
  12.    Left            =   1320
  13.    LinkTopic       =   "Form1"
  14.    LockControls    =   -1  'True
  15.    MaxButton       =   0   'False
  16.    MinButton       =   0   'False
  17.    ScaleHeight     =   3278.104
  18.    ScaleMode       =   0  'User
  19.    ScaleWidth      =   6554.436
  20.    Top             =   1305
  21.    Width           =   6645
  22.    Begin VB.CheckBox chkCopyData 
  23.       Caption         =   "Copy Data   "
  24.       Height          =   255
  25.       Left            =   3120
  26.       TabIndex        =   9
  27.       Top             =   2160
  28.       Width           =   3135
  29.    End
  30.    Begin VB.TextBox txtDatabase 
  31.       BackColor       =   &H00FFFFFF&
  32.       Height          =   285
  33.       Left            =   3045
  34.       TabIndex        =   1
  35.       Top             =   420
  36.       Width           =   3375
  37.    End
  38.    Begin VB.CommandButton cmdClose 
  39.       Cancel          =   -1  'True
  40.       Caption         =   "&Close"
  41.       Height          =   375
  42.       Left            =   4800
  43.       TabIndex        =   4
  44.       Top             =   2730
  45.       Width           =   1575
  46.    End
  47.    Begin VB.CommandButton cmdOK 
  48.       Caption         =   "&OK"
  49.       Default         =   -1  'True
  50.       Height          =   375
  51.       Left            =   3000
  52.       TabIndex        =   3
  53.       Top             =   2730
  54.       Width           =   1575
  55.    End
  56.    Begin VB.TextBox txtConnect 
  57.       BackColor       =   &H00FFFFFF&
  58.       Height          =   540
  59.       Left            =   3045
  60.       MultiLine       =   -1  'True
  61.       TabIndex        =   0
  62.       Top             =   1155
  63.       Width           =   3375
  64.    End
  65.    Begin VB.CheckBox chkCopyIndexes 
  66.       Caption         =   "Copy Indexes"
  67.       Height          =   255
  68.       Left            =   3120
  69.       TabIndex        =   2
  70.       Top             =   1800
  71.       Value           =   1  'Checked
  72.       Width           =   3165
  73.    End
  74.    Begin VB.ListBox lstTables 
  75.       BackColor       =   &H00FFFFFF&
  76.       Height          =   2760
  77.       Left            =   105
  78.       MultiSelect     =   2  'Extended
  79.       Sorted          =   -1  'True
  80.       TabIndex        =   5
  81.       Top             =   360
  82.       Width           =   2775
  83.    End
  84.    Begin VB.Label lblLabels 
  85.       AutoSize        =   -1  'True
  86.       Caption         =   "(Note:Export is Faster)"
  87.       Height          =   195
  88.       Index           =   3
  89.       Left            =   3360
  90.       TabIndex        =   10
  91.       Top             =   2400
  92.       Width           =   1575
  93.    End
  94.    Begin VB.Label lblLabels 
  95.       AutoSize        =   -1  'True
  96.       Caption         =   " Target Connect String: "
  97.       Height          =   195
  98.       Index           =   0
  99.       Left            =   3045
  100.       TabIndex        =   8
  101.       Top             =   840
  102.       Width           =   1695
  103.    End
  104.    Begin VB.Label lblLabels 
  105.       AutoSize        =   -1  'True
  106.       Caption         =   " Target Database: "
  107.       Height          =   195
  108.       Index           =   1
  109.       Left            =   3045
  110.       TabIndex        =   7
  111.       Top             =   105
  112.       Width           =   1335
  113.    End
  114.    Begin VB.Label lblLabels 
  115.       AutoSize        =   -1  'True
  116.       Caption         =   " Tables: "
  117.       Height          =   195
  118.       Index           =   2
  119.       Left            =   105
  120.       TabIndex        =   6
  121.       Top             =   105
  122.       Width           =   615
  123.    End
  124. Attribute VB_Name = "frmCopyStruct"
  125. Attribute VB_Creatable = False
  126. Attribute VB_Exposed = False
  127. Option Explicit
  128. Private Sub cmdClose_Click()
  129.   RefreshTables frmTables.lstTables, True  'just in case some were added
  130.   Unload Me
  131. End Sub
  132. Private Sub Form_Load()
  133.   Dim i As Integer
  134.   RefreshTables lstTables, False
  135.   txtDatabase.Text = gsDBName
  136.   txtConnect.Text = gdbCurrentDB.Connect
  137.   CenterMe Me, gnMDIFORM
  138.   'select the table that was selected ob the frmTables form
  139.   For i = 0 To lstTables.ListCount - 1
  140.     If lstTables.List(i) = frmTables.lstTables.Text Then
  141.       lstTables.Selected(i) = True
  142.       Exit For
  143.     End If
  144.   Next
  145. End Sub
  146. Private Sub cmdOK_Click()
  147.   Dim i As Integer
  148.   Dim bDifferentDB As Integer
  149.   Dim sToName As String
  150.   Dim dbToDatabase As Database
  151.   On Error GoTo OkayErr
  152.   MsgBar "Copying Table(s)", True
  153.   SetHourglass
  154.   If Len(txtDatabase.Text) = 0 Or txtDatabase.Text = gsDBName Then
  155.     Set dbToDatabase = gdbCurrentDB
  156.     bDifferentDB = False
  157.   Else
  158.     Set dbToDatabase = gwsMainWS.OpenDatabase(txtDatabase.Text, False, False, txtConnect.Text)
  159.     dbToDatabase.QueryTimeout = glQueryTimeout
  160.     bDifferentDB = True
  161.   End If
  162.   For i = 0 To lstTables.ListCount - 1
  163.     If lstTables.Selected(i) Then
  164.       If bDifferentDB = False Then
  165.         sToName = InputBox("Enter New Table Name:")
  166.         If Len(sToName) = 0 Then GoTo SkipIt
  167.       Else
  168.         sToName = (StripConnect(lstTables.List(i)))
  169.       End If
  170.     Else
  171.       GoTo SkipIt
  172.     End If
  173.     SetHourglass
  174.     If CopyStruct(gdbCurrentDB, dbToDatabase, (StripConnect(lstTables.List(i))), sToName, (chkCopyIndexes)) = True Then
  175.       If chkCopyData = 1 Then
  176.         If CopyData(gdbCurrentDB, dbToDatabase, (StripConnect(lstTables.List(i))), sToName) = False Then
  177.           Beep
  178.           MsgBox "Copy of Data To " & (StripConnect(lstTables.List(i))) & " was UnSuccessful!"
  179.         End If
  180.       End If
  181.       Screen.MousePointer = vbDefault
  182.       MsgBox "Copy of " & (StripConnect(lstTables.List(i))) & " Structure was Successful!"
  183.       lstTables.Selected(i) = False
  184.     Else
  185.       Screen.MousePointer = vbDefault
  186.       Beep
  187.       MsgBox "Copy of " & (StripConnect(lstTables.List(i))) & " UnSuccessful!"
  188.     End If
  189. SkipIt:
  190.   Next
  191.   MsgBar gsNULL_STR, False
  192.   Exit Sub
  193. OkayErr:
  194.   ShowError
  195.   Exit Sub
  196. End Sub
  197.