home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l406 / 4.ddi / VDMDI.FR_ / VDMDI.bin (.txt)
Encoding:
Visual Basic Form  |  1992-10-21  |  18.9 KB  |  654 lines

  1. VERSION 2.00
  2. Begin MDIForm VDMDI 
  3.    Caption         =   "Visual Data"
  4.    Height          =   6900
  5.    Icon            =   VDMDI.FRX:0000
  6.    Left            =   105
  7.    LinkTopic       =   "MDIForm1"
  8.    Top             =   90
  9.    Width           =   9135
  10.    Begin PictureBox Picture1 
  11.       Align           =   2  'Align Bottom
  12.       BackColor       =   &H00C0C0C0&
  13.       Height          =   240
  14.       Left            =   0
  15.       ScaleHeight     =   210
  16.       ScaleWidth      =   8985
  17.       TabIndex        =   9
  18.       Top             =   5970
  19.       Width           =   9015
  20.       Begin Label cMsg 
  21.          BackColor       =   &H00C0C0C0&
  22.          Caption         =   "Ready"
  23.          Height          =   200
  24.          Left            =   120
  25.          TabIndex        =   10
  26.          Top             =   0
  27.          Width           =   9372
  28.       End
  29.    End
  30.    Begin PictureBox ToolBar 
  31.       Align           =   1  'Align Top
  32.       BackColor       =   &H00C0C0C0&
  33.       Height          =   420
  34.       Left            =   0
  35.       ScaleHeight     =   396
  36.       ScaleMode       =   0  'User
  37.       ScaleWidth      =   9002.344
  38.       TabIndex        =   0
  39.       Top             =   0
  40.       Width           =   9015
  41.       Begin TextBox cQueryTimeout 
  42.          Height          =   288
  43.          Left            =   4319
  44.          TabIndex        =   7
  45.          Text            =   "5"
  46.          Top             =   48
  47.          Width           =   995
  48.       End
  49.       Begin CommandButton QueryButton 
  50.          Caption         =   "&Query Builder"
  51.          Height          =   336
  52.          Left            =   5400
  53.          TabIndex        =   6
  54.          Top             =   24
  55.          Visible         =   0   'False
  56.          Width           =   1331
  57.       End
  58.       Begin CommandButton BeginButton 
  59.          Caption         =   "&BeginTransaction"
  60.          Height          =   336
  61.          Left            =   6840
  62.          TabIndex        =   5
  63.          Top             =   24
  64.          Visible         =   0   'False
  65.          Width           =   1812
  66.       End
  67.       Begin CommandButton RollBackButton 
  68.          Caption         =   "&Rollback"
  69.          Height          =   336
  70.          Left            =   7920
  71.          TabIndex        =   4
  72.          Top             =   24
  73.          Visible         =   0   'False
  74.          Width           =   971
  75.       End
  76.       Begin CommandButton CommitButton 
  77.          Caption         =   "&Commit"
  78.          Height          =   336
  79.          Left            =   6840
  80.          TabIndex        =   3
  81.          Top             =   24
  82.          Visible         =   0   'False
  83.          Width           =   971
  84.       End
  85.       Begin OptionButton cTableView 
  86.          BackColor       =   &H00C0C0C0&
  87.          Caption         =   "Table View"
  88.          Height          =   252
  89.          Left            =   1680
  90.          TabIndex        =   2
  91.          Top             =   50
  92.          Width           =   1331
  93.       End
  94.       Begin OptionButton cSingleRecord 
  95.          BackColor       =   &H00C0C0C0&
  96.          Caption         =   "Single Record"
  97.          Height          =   252
  98.          Left            =   120
  99.          TabIndex        =   1
  100.          Top             =   50
  101.          Value           =   -1  'True
  102.          Width           =   1572
  103.       End
  104.       Begin Label QueryTimeoutLabel 
  105.          BackColor       =   &H00C0C0C0&
  106.          Caption         =   "QueryTimeout:"
  107.          Height          =   252
  108.          Left            =   2999
  109.          TabIndex        =   8
  110.          Top             =   100
  111.          Width           =   1331
  112.       End
  113.    End
  114.    Begin Menu DBMenu 
  115.       Caption         =   "&File"
  116.       Begin Menu DBOpen 
  117.          Caption         =   "&Open DataBase..."
  118.          Shortcut        =   ^O
  119.       End
  120.       Begin Menu DBClose 
  121.          Caption         =   "&Close DataBase"
  122.          Visible         =   0   'False
  123.       End
  124.       Begin Menu DBProperties 
  125.          Caption         =   "&Properties..."
  126.          Visible         =   0   'False
  127.       End
  128.       Begin Menu DBNew 
  129.          Caption         =   "&New (RegisterDataBase)..."
  130.       End
  131.       Begin Menu menubar1 
  132.          Caption         =   "-"
  133.       End
  134.       Begin Menu DBAbout 
  135.          Caption         =   "&About"
  136.       End
  137.       Begin Menu Exit 
  138.          Caption         =   "E&xit"
  139.          Shortcut        =   ^X
  140.       End
  141.    End
  142.    Begin Menu TblMenu 
  143.       Caption         =   "&Table"
  144.       Visible         =   0   'False
  145.       Begin Menu TblRefresh 
  146.          Caption         =   "&Refresh Table List"
  147.          Shortcut        =   ^R
  148.       End
  149.       Begin Menu TblCopyStruct 
  150.          Caption         =   "&Copy Structure..."
  151.       End
  152.       Begin Menu TblDelete 
  153.          Caption         =   "&Delete Table"
  154.       End
  155.       Begin Menu TblZap 
  156.          Caption         =   "Remove &All Records"
  157.       End
  158.    End
  159.    Begin Menu UtilMenu 
  160.       Caption         =   "&Utility"
  161.       Visible         =   0   'False
  162.       Begin Menu UtilCloseAll 
  163.          Caption         =   "&Close All Dynasets"
  164.       End
  165.       Begin Menu UtilReplace 
  166.          Caption         =   "&Global Replace..."
  167.       End
  168.       Begin Menu UtilExport 
  169.          Caption         =   "&Export to Tab Delimited File..."
  170.       End
  171.    End
  172.    Begin Menu PrefMenu 
  173.       Caption         =   "&Preferences"
  174.       Begin Menu PrefOpenOnStartup 
  175.          Caption         =   "&Open Last DataBase on Startup"
  176.       End
  177.       Begin Menu PrefFilter 
  178.          Caption         =   "&Table List Filter..."
  179.       End
  180.       Begin Menu PrefMaxRows 
  181.          Caption         =   "&Max Table View Rows"
  182.       End
  183.    End
  184.    Begin Menu WinMenu 
  185.       Caption         =   "&Window"
  186.       Begin Menu WinTile 
  187.          Caption         =   "&Tile"
  188.       End
  189.       Begin Menu WinCascade 
  190.          Caption         =   "&Cascade"
  191.       End
  192.       Begin Menu WinArrange 
  193.          Caption         =   "&Arrange Icons"
  194.       End
  195.       Begin Menu menubar2 
  196.          Caption         =   "-"
  197.       End
  198.       Begin Menu WinTables 
  199.          Caption         =   "Ta&bles"
  200.       End
  201.       Begin Menu WinSQL 
  202.          Caption         =   "&SQL"
  203.       End
  204.    End
  205. Option Explicit
  206. Sub BeginButton_Click ()
  207.   On Error GoTo BeginErr
  208.   gCurrentDB.BeginTrans
  209.   gfDBChanged = False
  210.   gfTransPending = True
  211.   BeginButton.Visible = False
  212.   CommitButton.Visible = True
  213.   RollBackButton.Visible = True
  214.   CommitButton.SetFocus
  215.   GoTo BeginTransEnd
  216. BeginErr:
  217.   ShowError
  218.   Resume BeginTransEnd
  219. BeginTransEnd:
  220. End Sub
  221. Sub CommitButton_Click ()
  222.   On Error GoTo CommitErr
  223.   gCurrentDB.CommitTrans
  224.   gfDBChanged = False
  225.   gfTransPending = False
  226.   BeginButton.Visible = True
  227.   CommitButton.Visible = False
  228.   RollBackButton.Visible = False
  229.   BeginButton.SetFocus
  230.   GoTo DBCommitTransEnd
  231. CommitErr:
  232.   ShowError
  233.   Resume DBCommitTransEnd
  234. DBCommitTransEnd:
  235. End Sub
  236. Sub cQueryTimeout_KeyPress (KeyAscii As Integer)
  237.   'throw away non numeric chars
  238.   'allow backspace
  239.   If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 8 Then
  240.     Beep
  241.     KeyAscii = 0
  242.   End If
  243. End Sub
  244. Sub cQueryTimeout_LostFocus ()
  245.   On Error GoTo QTErr
  246.   'try to set the new value
  247.   gCurrentDB.QueryTimeout = Val(cQueryTimeout)
  248.   GoTo QTEnd
  249. QTErr:
  250.   ShowError
  251.   'reset the form control after the error
  252.   cQueryTimeout = gCurrentDB.QueryTimeout
  253.   Resume QTEnd
  254. QTEnd:
  255. End Sub
  256. Sub DBAbout_Click ()
  257.   MsgBar "Press any key to Close About Box", False
  258.   AboutBox.Show MODAL
  259.   MsgBar "", False
  260. End Sub
  261. Sub DBClose_Click ()
  262.   On Error GoTo DBCloseErr
  263.   If gfDBChanged Then
  264.     If MsgBox("Data has been changed, Commit it?", MSGBOX_TYPE) = YES Then
  265.       gCurrentDB.CommitTrans
  266.       gfDBChanged = False
  267.     Else
  268.       If MsgBox("RollBack All changes?", MSGBOX_TYPE) = YES Then
  269.         gCurrentDB.Rollback
  270.         gfDBChanged = False
  271.       Else
  272.         Beep
  273.         MsgBox "Can't Close with Transactions Pending!", 48
  274.         Exit Sub
  275.       End If
  276.     End If
  277.   End If
  278.   gCurrentDB.Close
  279.   fTables.Caption = "<none>"
  280.   fTables.cTableList.Clear
  281.   DBProperties.Visible = False
  282.   DBClose.Visible = False
  283.   TblMenu.Visible = False
  284.   UtilMenu.Visible = False
  285.   QueryButton.Visible = False
  286.   BeginButton.Visible = False
  287.   gfDBOpenFlag = False
  288.   gfTransPending = False
  289.   CloseAllDynasets
  290.   Unload fQuery
  291.   GoTo DBCloseEnd
  292. DBCloseErr:
  293.   ShowError
  294.   Resume DBCloseEnd
  295. DBCloseEnd:
  296. End Sub
  297. Sub DBNew_Click ()
  298.   Dim driver As String
  299.   On Error GoTo DBNErr
  300.   MsgBar "Enter New Database Parameters", False
  301.   'driver must be an valid entry in ODBCINST.INI
  302.   driver = InputBox("Enter Driver Name from ODBCINST.INI File:", "Driver Name", DEFAULTDRIVER)
  303. '  driver = DEFAULTDRIVER
  304.   RegisterDatabase "", driver, False, ""
  305.   GoTo DBNEnd
  306. DBNErr:
  307.   ShowError
  308.   Resume DBNEnd
  309. DBNEnd:
  310.   MsgBar "", False
  311. End Sub
  312. Sub DBOpen_Click ()
  313.    If gfDBOpenFlag = True Then
  314.      Call DBClose_Click
  315.    End If
  316.    If gfDBOpenFlag = True Then
  317.      Beep
  318.      MsgBox "You must Close First!", 48
  319.    Else
  320.      fOpenDB.Show MODAL
  321.    End If
  322.    If gfDBOpenFlag = True Then
  323.      DBProperties.Visible = True
  324.      DBClose.Visible = True
  325.      TblMenu.Visible = True
  326.      UtilMenu.Visible = True
  327.      RefreshTables fTables.cTableList
  328.    End If
  329. End Sub
  330. Sub DBProperties_Click ()
  331.    Dim f As New fDataBox
  332.    Dim s As String, t As String
  333.    Dim i As Integer
  334.    On Error GoTo PropErr
  335.    f.Caption = gCurrentDB.Name + " Properties"
  336.    f.Top = Top + 900
  337.    f.Left = Left + 100
  338.    'process the connect string
  339.    t = gCurrentDB.Connect
  340.    i = 1
  341.    While i <= Len(t) + 1
  342.      If Mid(t, i, 1) = ";" Or i = Len(t) + 1 Then
  343.        f.cData.AddItem s
  344.        s = ""
  345.      Else
  346.        s = s + Mid(t, i, 1)
  347.      End If
  348.      i = i + 1
  349.    Wend
  350.    f.cData.AddItem ""
  351.    'set the value of the updatable flag
  352.    If gCurrentDB.Updatable Then
  353.      s = TRUE_ST
  354.    Else
  355.      s = FALSE_ST
  356.    End If
  357.    f.cData.AddItem "Updatable = " + s
  358.    'set the value of the transactions flag
  359.    If gCurrentDB.Transactions Then
  360.      s = TRUE_ST
  361.    Else
  362.      s = FALSE_ST
  363.    End If
  364.    f.cData.AddItem "Transactions = " + s
  365.    f.cData.AddItem "Query Timeout = " + cQueryTimeout + " seconds"
  366.    f.Show
  367.   GoTo DBPropEnd
  368. PropErr:
  369.   ShowError
  370.   Resume DBPropEnd
  371. DBPropEnd:
  372. End Sub
  373. Sub Exit_Click ()
  374.   Unload Me
  375. End Sub
  376. Sub MDIForm_Load ()
  377.   Dim st As String
  378.   Dim x As Integer
  379.   gwMaxGridRows = Val(GetINIString("MaxRows", "250"))
  380.   cQueryTimeout = Val(GetINIString("QueryTimeout", "5"))
  381.   st = GetINIString("ViewMode", "Single")
  382.   If UCase(st) = "SINGLE" Then
  383.     cSingleRecord = True
  384.   Else
  385.     cTableView = True
  386.   End If
  387.   st = GetINIString("OpenOnStartup", "No")
  388.   If UCase(st) = "YES" Then
  389.     PrefOpenOnStartup.Checked = True
  390.   Else
  391.     PrefOpenOnStartup.Checked = False
  392.   End If
  393.   'get the last used database out of the INI file
  394.   gstDBNAme = GetINIString("Server", "")
  395.   gstDataBase = GetINIString("DataBase", "")
  396.   gstUserNAme = GetINIString("UserName", "")
  397.   gstPassword = GetINIString("Password", "")
  398.   If PrefOpenOnStartup.Checked = True Then
  399.     SendKeys "%FO{Enter}"   'force open database
  400.   Else
  401.     SendKeys "%FO"   'force open database dialog
  402.   End If
  403.   x = Val(GetINIString("WindowState", "2"))
  404.   If x <> 1 Then
  405.     WindowState = x
  406.   Else
  407.     WindowState = 0
  408.   End If
  409.   If x = 0 Then
  410.     x = Val(GetINIString("WindowLeft", "0"))
  411.     Left = x
  412.     x = Val(GetINIString("WindowTop", "0"))
  413.     Top = x
  414.     x = Val(GetINIString("WindowWidth", "9135"))
  415.     Width = x
  416.     x = Val(GetINIString("WindowHeight", "6900"))
  417.     Height = x
  418.   End If
  419.   Me.Show
  420.   fSQL.Show
  421. End Sub
  422. Sub MDIForm_QueryUnload (Cancel As Integer, UnloadMode As Integer)
  423.   Dim x As Integer
  424.   Dim st As String
  425.   On Error Resume Next
  426.   x = OSWritePrivateProfileString("VISDATA", "Server", gstDBNAme, "VISDATA.INI")
  427.   x = OSWritePrivateProfileString("VISDATA", "DataBase", gstDataBase, "VISDATA.INI")
  428.   x = OSWritePrivateProfileString("VISDATA", "UserName", gstUserNAme, "VISDATA.INI")
  429.   x = OSWritePrivateProfileString("VISDATA", "Password", gstPassword, "VISDATA.INI")
  430.   If PrefOpenOnStartup.Checked = True Then
  431.     st = "Yes"
  432.   Else
  433.     st = "No"
  434.   End If
  435.   x = OSWritePrivateProfileString("VISDATA", "OpenOnStartup", st, "VISDATA.INI")
  436.   x = OSWritePrivateProfileString("VISDATA", "WindowState", CStr(WindowState), "VISDATA.INI")
  437.   If WindowState <> 2 Then
  438.     x = OSWritePrivateProfileString("VISDATA", "WindowTop", CStr(Top), "VISDATA.INI")
  439.     x = OSWritePrivateProfileString("VISDATA", "WindowLeft", CStr(Left), "VISDATA.INI")
  440.     x = OSWritePrivateProfileString("VISDATA", "WindowWidth", CStr(Width), "VISDATA.INI")
  441.     x = OSWritePrivateProfileString("VISDATA", "WindowHeight", CStr(Height), "VISDATA.INI")
  442.   End If
  443.   x = OSWritePrivateProfileString("VISDATA", "TableFilter", gstTableFilter, "VISDATA.INI")
  444.   x = OSWritePrivateProfileString("VISDATA", "MaxRows", CStr(gwMaxGridRows), "VISDATA.INI")
  445.   x = OSWritePrivateProfileString("VISDATA", "QueryTimeout", cQueryTimeout, "VISDATA.INI")
  446.   If VDMDI.cSingleRecord = True Then
  447.     st = "Single"
  448.   Else
  449.     st = "Table"
  450.   End If
  451.   x = OSWritePrivateProfileString("VISDATA", "ViewMode", st, "VISDATA.INI")
  452.   x = OSWritePrivateProfileString("VISDATA", "SQLStatement", fSQL.cSQLStatement, "VISDATA.INI")
  453.   If fSQL.WindowState <> 1 Then
  454.     x = OSWritePrivateProfileString("VISDATA", "SQLWindowTop", CStr(fSQL.Top), "VISDATA.INI")
  455.     x = OSWritePrivateProfileString("VISDATA", "SQLWindowLeft", CStr(fSQL.Left), "VISDATA.INI")
  456.     x = OSWritePrivateProfileString("VISDATA", "SQLWindowWidth", CStr(fSQL.Width), "VISDATA.INI")
  457.     x = OSWritePrivateProfileString("VISDATA", "SQLWindowHeight", CStr(fSQL.Height), "VISDATA.INI")
  458.   End If
  459.   If gfDBChanged Then
  460.     If MsgBox("Data has been changed, Commit it?", MSGBOX_TYPE) = YES Then
  461.       gCurrentDB.CommitTrans
  462.     End If
  463.   End If
  464.   If gfDBOpenFlag Then gCurrentDB.Close
  465.   End
  466. End Sub
  467. Sub PrefFilter_Click ()
  468.   Dim st As String
  469.   Dim CR As String
  470.   MsgBar "Enter New Table List Filter", False
  471.   CR = Chr(13) + Chr(10)
  472.   st = InputBox("Enter ',' Delimited Set of Table List Filters:" + CR + CR + "Use - to Exclude." + CR + CR + "test* Includes test* Tables." + CR + CR + "-sys* Excludes sys* Tables." + CR + CR + "* Alone Shows All Tables.", "Table Filter", gstTableFilter)
  473.   If st <> gstTableFilter Then
  474.     If UCase(st) = "*" Then
  475.       gstTableFilter = ""
  476.     Else
  477.       gstTableFilter = st
  478.     End If
  479.     If gfDBOpenFlag = True Then RefreshTables fTables.cTableList
  480.   End If
  481.   MsgBar "", False
  482. End Sub
  483. Sub PrefMaxRows_Click ()
  484.   Dim st As String
  485.   Dim CR As String
  486.   MsgBar "Enter Maximum Rows to Show in Table View", False
  487.   st = InputBox("Enter New Value:", "Max Table View Rows", CStr(gwMaxGridRows))
  488.   If st <> "" Then
  489.     If Val(st) > MAX_GRID_ROWS Then
  490.       MsgBox "Maximum Rows is " + CStr(MAX_GRID_ROWS), 48
  491.       gwMaxGridRows = MAX_GRID_ROWS
  492.     ElseIf Val(st) = 0 Then
  493.       MsgBox "Minimum Rows is 1.", 48
  494.       gwMaxGridRows = 1
  495.     Else
  496.       gwMaxGridRows = Val(st)
  497.     End If
  498.   End If
  499.   MsgBar "", False
  500. End Sub
  501. Sub PrefOpenOnStartup_Click ()
  502.   'toggle the menu item
  503.   If PrefOpenOnStartup.Checked = True Then
  504.     PrefOpenOnStartup.Checked = False
  505.   Else
  506.     PrefOpenOnStartup.Checked = True
  507.   End If
  508. End Sub
  509. Sub QueryButton_Click ()
  510.   fQuery.WindowState = 0
  511. End Sub
  512. Sub RollBackButton_Click ()
  513.   On Error GoTo RollbackErr
  514.   If MsgBox("All changes will be gone, Rollback anyway?", MSGBOX_TYPE) = YES Then
  515.     gCurrentDB.Rollback
  516.     gfDBChanged = False
  517.     gfTransPending = False
  518.     QueryButton.Visible = True
  519.     BeginButton.Visible = True
  520.     CommitButton.Visible = False
  521.     RollBackButton.Visible = False
  522.     BeginButton.SetFocus
  523.   End If
  524.   GoTo DBRollbackEnd
  525. RollbackErr:
  526.   ShowError
  527.   Resume DBRollbackEnd
  528. DBRollbackEnd:
  529. End Sub
  530. Sub TblCopyStruct_Click ()
  531.   fCpyStru.Show MODAL
  532. End Sub
  533. Sub TblDelete_Click ()
  534.   On Error GoTo TblDelErr
  535.   If fTables.cTableList = "" Then
  536.     MsgBox "No Table Selected", 48
  537.     Exit Sub
  538.   End If
  539.   If MsgBox("Delete """ + fTables.cTableList + """ table?", MSGBOX_TYPE) = YES Then
  540.     gCurrentDB.TableDefs.Delete gCurrentDB.TableDefs(fTables.cTableList)
  541.     fTables.cTableList.RemoveItem fTables.cTableList.ListIndex
  542.   End If
  543.   GoTo TblDelEnd
  544. TblDelErr:
  545.   ShowError
  546.   Resume TblDelEnd
  547. TblDelEnd:
  548. End Sub
  549. Sub TblRefresh_Click ()
  550.   RefreshTables fTables.cTableList
  551. End Sub
  552. Sub TblZap_Click ()
  553.   Dim RetSQL As Long
  554.   If fTables.cTableList = "" Then
  555.     MsgBox "No Table Selected", 48
  556.     Exit Sub
  557.   End If
  558.   On Error GoTo ZapErr
  559.   If MsgBox("Delete All Records in " + fTables.cTableList + "?", MSGBOX_TYPE) = YES Then
  560.     'delete all rows with a sql statement
  561.     RetSQL = gCurrentDB.ExecuteSQL("delete from " + fTables.cTableList)
  562.     If RetSQL > 0 Then
  563.       MsgBox CStr(RetSQL) + " rows deleted!", 48
  564.       If gfTransPending Then gfDBChanged = True
  565.     End If
  566.   End If
  567.   GoTo ZapEnd
  568. ZapErr:
  569.   If Err = EOF_ERR Then Resume Next
  570.   ShowError
  571.   Resume ZapEnd
  572. ZapEnd:
  573. End Sub
  574. Sub UtilCloseAll_Click ()
  575.   CloseAllDynasets
  576. End Sub
  577. Sub UtilExport_Click ()
  578.   Dim ds As Dynaset
  579.   Dim l As Long
  580.   Dim i As Integer
  581.   Dim fn As String
  582.   Dim st As String
  583.   On Error GoTo ExportErr
  584.   If fTables.cTableList = "" And UCase(Mid(fSQL.cSQLStatement, 1, 6)) <> "SELECT" Then
  585.     MsgBox "No Table Selected", 48
  586.     Exit Sub
  587.   End If
  588.   fn = InputBox("Enter Path\FileName to Export to:", "Export File", "VISDATA.TXT")
  589.   If fn = "" Then Exit Sub
  590.   SetHourGlass Me
  591.   MsgBar "Exporting Data to " + fn, True
  592.   If UCase(Mid(fSQL.cSQLStatement, 1, 6)) = "SELECT" Then
  593.     Set ds = gCurrentDB.CreateDynaset(fSQL.cSQLStatement)
  594.   Else
  595.     Set ds = gCurrentDB.CreateDynaset(fTables.cTableList)
  596.   End If
  597.   Open fn For Output As #1
  598.   'output the field names
  599.   For i = 0 To ds.Fields.Count - 1
  600.     st = Chr$(9)
  601.     st = st + ds(i).Name + Chr$(9)
  602.   Next
  603.   Print #1, st
  604.   'output the field contents
  605.   l = 1
  606.   While ds.EOF = False
  607.     st = CStr(l) + Chr$(9)
  608.     For i = 0 To ds.Fields.Count - 1
  609.       st = st + ds(i) + Chr$(9)
  610.     Next
  611.     Print #1, st
  612.     ds.MoveNext
  613.     l = l + 1
  614.   Wend
  615.   GoTo ExportEnd
  616. ExportErr:
  617.   ShowError
  618.   Resume ExportEnd
  619. ExportEnd:
  620.   Close #1
  621.   ResetMouse Me
  622.   MsgBar "", False
  623. End Sub
  624. Sub UtilReplace_Click ()
  625.   Dim i As Integer
  626.   Dim sb As String
  627.   On Error GoTo ReplaceErr
  628.   RefreshTables fReplace.cTableList
  629.   fReplace.Show
  630.   GoTo ReplaceEnd
  631. ReplaceErr:
  632.   ShowError
  633.   Resume ReplaceEnd
  634. ReplaceEnd:
  635. End Sub
  636. Sub WinArrange_Click ()
  637.   Me.Arrange 3
  638. End Sub
  639. Sub WinCascade_Click ()
  640.   Me.Arrange 0
  641. End Sub
  642. Sub WinSQL_Click ()
  643.   fSQL.WindowState = 0
  644. End Sub
  645. Sub WinTables_Click ()
  646.   fTables.WindowState = 0
  647.   If fTables.cTableList.ListCount = 0 And gfDBOpenFlag = True Then
  648.     RefreshTables fTables.cTableList
  649.   End If
  650. End Sub
  651. Sub WinTile_Click ()
  652.   Me.Arrange 2
  653. End Sub
  654.