home *** CD-ROM | disk | FTP | other *** search
/ Internet Publisher's Toolbox 1.0 / Image.iso / toolbox / httpdsrv / vbs31src / vdmdi.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-12-29  |  37.7 KB  |  1,242 lines

  1. VERSION 2.00
  2. Begin MDIForm VDMDI 
  3.    Caption         =   "Visual Data"
  4.    ClientHeight    =   6210
  5.    ClientLeft      =   240
  6.    ClientTop       =   1710
  7.    ClientWidth     =   9015
  8.    Height          =   6900
  9.    Icon            =   VDMDI.FRX:0000
  10.    Left            =   180
  11.    LinkTopic       =   "MDIForm1"
  12.    Top             =   1080
  13.    Width           =   9135
  14.    Begin PictureBox Picture1 
  15.       Align           =   2  'Align Bottom
  16.       BackColor       =   &H00C0C0C0&
  17.       Height          =   240
  18.       Left            =   0
  19.       ScaleHeight     =   210
  20.       ScaleWidth      =   8985
  21.       TabIndex        =   6
  22.       Top             =   5970
  23.       Width           =   9015
  24.       Begin CommonDialog CMD1 
  25.          Left            =   8085
  26.          Top             =   0
  27.       End
  28.       Begin Label cMsg 
  29.          BackColor       =   &H00C0C0C0&
  30.          Caption         =   "Ready"
  31.          Height          =   200
  32.          Left            =   120
  33.          TabIndex        =   7
  34.          Top             =   0
  35.          Width           =   9372
  36.       End
  37.    End
  38.    Begin PictureBox ToolBar 
  39.       Align           =   1  'Align Top
  40.       BackColor       =   &H00C0C0C0&
  41.       Height          =   360
  42.       Left            =   0
  43.       ScaleHeight     =   335.077
  44.       ScaleMode       =   0  'User
  45.       ScaleWidth      =   9002.344
  46.       TabIndex        =   0
  47.       TabStop         =   0   'False
  48.       Top             =   0
  49.       Visible         =   0   'False
  50.       Width           =   9015
  51.       Begin OptionButton cDataCtl 
  52.          BackColor       =   &H00C0C0C0&
  53.          Caption         =   "Data Control"
  54.          Height          =   255
  55.          Left            =   2160
  56.          TabIndex        =   8
  57.          Top             =   30
  58.          Value           =   -1  'True
  59.          Width           =   1545
  60.       End
  61.       Begin CommandButton BeginButton 
  62.          Caption         =   "BeginTransaction"
  63.          Height          =   336
  64.          Left            =   6930
  65.          TabIndex        =   5
  66.          Top             =   0
  67.          Width           =   1812
  68.       End
  69.       Begin CommandButton RollBackButton 
  70.          Caption         =   "Rollback"
  71.          Height          =   336
  72.          Left            =   7920
  73.          TabIndex        =   4
  74.          Top             =   0
  75.          Visible         =   0   'False
  76.          Width           =   971
  77.       End
  78.       Begin CommandButton CommitButton 
  79.          Caption         =   "Commit"
  80.          Height          =   336
  81.          Left            =   6840
  82.          TabIndex        =   3
  83.          Top             =   0
  84.          Visible         =   0   'False
  85.          Width           =   971
  86.       End
  87.       Begin OptionButton cTableView 
  88.          BackColor       =   &H00C0C0C0&
  89.          Caption         =   "Grid"
  90.          Height          =   255
  91.          Left            =   5640
  92.          TabIndex        =   2
  93.          Top             =   30
  94.          Width           =   810
  95.       End
  96.       Begin OptionButton cSingleRecord 
  97.          BackColor       =   &H00C0C0C0&
  98.          Caption         =   "No Data Control"
  99.          Height          =   255
  100.          Left            =   3720
  101.          TabIndex        =   1
  102.          Top             =   30
  103.          Width           =   1800
  104.       End
  105.       Begin Label DynFormType 
  106.          BackColor       =   &H00C0C0C0&
  107.          Caption         =   "RecordSet Form Type:"
  108.          Height          =   225
  109.          Left            =   45
  110.          TabIndex        =   9
  111.          Top             =   45
  112.          Width           =   2010
  113.       End
  114.    End
  115.    Begin Menu DBMenu 
  116.       Caption         =   "&File"
  117.       Begin Menu DBOpen 
  118.          Caption         =   "&Open DataBase..."
  119.          Begin Menu DBOpen_Access 
  120.             Caption         =   "&MS Access..."
  121.          End
  122.          Begin Menu DBOpen_dBASE3 
  123.             Caption         =   "&dBASE III..."
  124.          End
  125.          Begin Menu DBOpen_dBASE4 
  126.             Caption         =   "dB&ASE IV..."
  127.          End
  128.          Begin Menu DBOpen_FoxPro 
  129.             Caption         =   "&FoxPro 2.0..."
  130.          End
  131.          Begin Menu DBOpen_Fox25 
  132.             Caption         =   "Fo&xPro 2.5..."
  133.          End
  134.          Begin Menu DBOpen_Paradox 
  135.             Caption         =   "&Paradox 3.X..."
  136.          End
  137.          Begin Menu Open_paradox4x 
  138.             Caption         =   "Pa&radox 4.X..."
  139.          End
  140.          Begin Menu DBOpen_Btrieve 
  141.             Caption         =   "&Btrieve..."
  142.          End
  143.          Begin Menu DBOpen_ODBC 
  144.             Caption         =   "&ODBC..."
  145.          End
  146.       End
  147.       Begin Menu DBClose 
  148.          Caption         =   "&Close DataBase"
  149.          Shortcut        =   ^C
  150.          Visible         =   0   'False
  151.       End
  152.       Begin Menu DBProperties 
  153.          Caption         =   "&Properties..."
  154.          Visible         =   0   'False
  155.       End
  156.       Begin Menu DBNew 
  157.          Caption         =   "&New..."
  158.          Begin Menu DBNew_Access 
  159.             Caption         =   "&MS Access..."
  160.          End
  161.          Begin Menu DBNew_dBASE3 
  162.             Caption         =   "&dBASE III..."
  163.          End
  164.          Begin Menu DBNew_dBASE4 
  165.             Caption         =   "dB&ASE IV..."
  166.          End
  167.          Begin Menu DBNew_FoxPro 
  168.             Caption         =   "&FoxPro 2.0..."
  169.          End
  170.          Begin Menu DBNew_Fox25 
  171.             Caption         =   "Fo&xPro 2.5..."
  172.          End
  173.          Begin Menu DBNew_Paradox 
  174.             Caption         =   "&Paradox 3.X..."
  175.          End
  176.          Begin Menu New_paradox4x 
  177.             Caption         =   "Pa&radox 4.X..."
  178.          End
  179.          Begin Menu DBNew_Btrieve 
  180.             Caption         =   "&Btrieve..."
  181.          End
  182.          Begin Menu DBNew_ODBC 
  183.             Caption         =   "&ODBC..."
  184.          End
  185.       End
  186.       Begin Menu menubar1 
  187.          Caption         =   "-"
  188.       End
  189.       Begin Menu DBAbout 
  190.          Caption         =   "&About"
  191.       End
  192.       Begin Menu Exit 
  193.          Caption         =   "E&xit"
  194.          Shortcut        =   ^X
  195.       End
  196.    End
  197.    Begin Menu TblMenu 
  198.       Caption         =   "&Table"
  199.       Visible         =   0   'False
  200.       Begin Menu TblRefresh 
  201.          Caption         =   "&Refresh Table List"
  202.          Shortcut        =   ^R
  203.       End
  204.       Begin Menu TblCopyStruct 
  205.          Caption         =   "&Copy..."
  206.       End
  207.       Begin Menu TblDelete 
  208.          Caption         =   "&Delete Table"
  209.          Shortcut        =   +{DEL}
  210.       End
  211.       Begin Menu TblProperties 
  212.          Caption         =   "&Properties..."
  213.       End
  214.       Begin Menu TblAttach 
  215.          Caption         =   "&Attach..."
  216.          Visible         =   0   'False
  217.       End
  218.       Begin Menu TblZap 
  219.          Caption         =   "Remove &All Records"
  220.       End
  221.    End
  222.    Begin Menu QueryBuilder 
  223.       Caption         =   "Query!"
  224.       Visible         =   0   'False
  225.    End
  226.    Begin Menu UtilMenu 
  227.       Caption         =   "&Utility"
  228.       Visible         =   0   'False
  229.       Begin Menu UtilCloseAll 
  230.          Caption         =   "&Close All RecordSet Forms"
  231.       End
  232.       Begin Menu UtilReplace 
  233.          Caption         =   "&Global Replace..."
  234.       End
  235.       Begin Menu UtilExport 
  236.          Caption         =   "&Export to Tab Delimited File..."
  237.       End
  238.       Begin Menu menubar3 
  239.          Caption         =   "-"
  240.       End
  241.       Begin Menu UtilCompactDB 
  242.          Caption         =   "C&ompact Database"
  243.       End
  244.       Begin Menu UtilRepairDB 
  245.          Caption         =   "&Repair Database"
  246.       End
  247.    End
  248.    Begin Menu PrefMenu 
  249.       Caption         =   "&Preferences"
  250.       Begin Menu PrefOpenOnStartup 
  251.          Caption         =   "&Open Last DataBase on Startup"
  252.       End
  253.       Begin Menu menubar4 
  254.          Caption         =   "-"
  255.       End
  256.       Begin Menu PrefQueryTimeout 
  257.          Caption         =   "&Query Timeout Value..."
  258.       End
  259.       Begin Menu PrefLoginTimeout 
  260.          Caption         =   "&Login Timeout Value..."
  261.       End
  262.       Begin Menu PrefMaxRows 
  263.          Caption         =   "&Max Grid View Rows..."
  264.       End
  265.       Begin Menu menubar5 
  266.          Caption         =   "-"
  267.       End
  268.       Begin Menu PrefShowPerf 
  269.          Caption         =   "&Show Performance Numbers"
  270.       End
  271.       Begin Menu PrefAllowSys 
  272.          Caption         =   "&Include System Tables"
  273.       End
  274.       Begin Menu PrefDisplaySQL 
  275.          Caption         =   "&Display QueryDef SQL Text"
  276.       End
  277.    End
  278.    Begin Menu WinMenu 
  279.       Caption         =   "&Window"
  280.       Begin Menu WinTile 
  281.          Caption         =   "&Tile"
  282.       End
  283.       Begin Menu WinCascade 
  284.          Caption         =   "&Cascade"
  285.       End
  286.       Begin Menu WinArrange 
  287.          Caption         =   "&Arrange Icons"
  288.       End
  289.       Begin Menu menubar2 
  290.          Caption         =   "-"
  291.       End
  292.       Begin Menu WinTables 
  293.          Caption         =   "Ta&bles"
  294.          Shortcut        =   ^T
  295.       End
  296.       Begin Menu WinSQL 
  297.          Caption         =   "&SQL"
  298.          Shortcut        =   ^S
  299.       End
  300.    End
  301. ' Fix Query Unload for INI bug (rbd -- see QueryUnload())
  302. ' Updated per MS PSS Article Q115976 for Jet 2.0 (rbd 12/8/94)
  303. ' Fixed missing Paradox 4.X profile entry (rbd 12/29/94)
  304. Option Explicit
  305. Option Compare Binary
  306. Sub BeginButton_Click ()
  307.   On Error GoTo BeginErr
  308.   If gCurrentDB.Transactions = False Then
  309.     Beep
  310.     MsgBox "Transactions not supported by this Driver!"
  311.     Exit Sub
  312.   End If
  313.   gCurrentDB.BeginTrans
  314.   gfDBChanged = False
  315.   gfTransPending = True
  316.   BeginButton.Visible = False
  317.   CommitButton.Visible = True
  318.   RollBackButton.Visible = True
  319.   CommitButton.SetFocus
  320.   GoTo BeginTransEnd
  321. BeginErr:
  322.   ShowError
  323.   Resume BeginTransEnd
  324. BeginTransEnd:
  325. End Sub
  326. Sub CommitButton_Click ()
  327.   On Error GoTo CommitErr
  328.   gCurrentDB.CommitTrans
  329.   gfDBChanged = False
  330.   gfTransPending = False
  331.   BeginButton.Visible = True
  332.   CommitButton.Visible = False
  333.   RollBackButton.Visible = False
  334.   BeginButton.SetFocus
  335.   GoTo DBCommitTransEnd
  336. CommitErr:
  337.   ShowError
  338.   Resume DBCommitTransEnd
  339. DBCommitTransEnd:
  340. End Sub
  341. Sub DBAbout_Click ()
  342.   MsgBar "Press any key to Close About Box", False
  343.   AboutBox.Show MODAL
  344.   MsgBar "", False
  345. End Sub
  346. Sub DBClose_Click ()
  347.   On Error GoTo DBCloseErr
  348.   If gfDBChanged Then
  349.     If MsgBox("Data has been changed, Commit it?", MSGBOX_TYPE) = YES Then
  350.       gCurrentDB.CommitTrans
  351.       gfDBChanged = False
  352.     Else
  353.       If MsgBox("RollBack All changes?", MSGBOX_TYPE) = YES Then
  354.         gCurrentDB.Rollback
  355.         gfDBChanged = False
  356.       Else
  357.         Beep
  358.         MsgBox "Can't Close with Transactions Pending!", 48
  359.         Exit Sub
  360.       End If
  361.     End If
  362.   End If
  363.   gTableListSS.Close
  364.   CloseAllDynasets
  365.   gCurrentDB.Close
  366.   fTables.Caption = "<none>"
  367.   fTables.cTableList.Clear
  368.   fTables.TableListLabel = "Tables:"
  369.   DBProperties.Visible = False
  370.   DBClose.Visible = False
  371.   TblAttach.Visible = False
  372.   TblMenu.Visible = False
  373.   UtilMenu.Visible = False
  374.   ToolBar.Visible = False
  375.   QueryBuilder.Visible = False
  376.   gfDBOpenFlag = False
  377.   gfTransPending = False
  378.   gstDBName = ""
  379.   Unload fQuery
  380.   GoTo DBCloseEnd
  381. DBCloseErr:
  382.   ShowError
  383.   Resume DBCloseEnd
  384. DBCloseEnd:
  385. End Sub
  386. Sub DBNew_Access_Click ()
  387.    Dim nn As String
  388.    Dim d As Database
  389.    Dim v10 As Integer
  390.    On Error GoTo NewAccErr
  391.    nn = InputBox("Enter Name for New MS Access Database:")
  392.    If nn = "" Then Exit Sub
  393.    If MsgBox("Make New Database Access 1.0 Compatible?", MSGBOX_TYPE) = YES Then
  394.      Set d = CreateDatabase(nn, DB_CREATE_GENERAL, DB_VERSION10)
  395.    Else
  396.      Set d = CreateDatabase(nn, DB_CREATE_GENERAL, 0)
  397.    End If
  398.    d.Close
  399.    gstDataType = "MS Access"
  400.    gstDBName = nn
  401.    OpenLocalDB True
  402.    If gfDBOpenFlag = True Then
  403.      DBProperties.Visible = True
  404.      DBClose.Visible = True
  405.      TblMenu.Visible = True
  406.      UtilMenu.Visible = True
  407.      RefreshTables fTables.cTableList, True
  408.      fSQL.CreateQueryDefbtn.Visible = True
  409.      TblAttach.Visible = True
  410.    End If
  411.   GoTo NewAccEnd
  412. NewAccErr:
  413.   ShowError
  414.   Resume NewAccEnd
  415. NewAccEnd:
  416. End Sub
  417. Sub DBNew_Btrieve_Click ()
  418.    gstDataType = "Btrieve"
  419.    NewLocalISAM
  420. End Sub
  421. Sub DBNew_dBASE3_Click ()
  422.    gstDataType = "dBASE III"
  423.    NewLocalISAM
  424. End Sub
  425. Sub DBNew_dBASE4_Click ()
  426.    gstDataType = "dBASE IV"
  427.    NewLocalISAM
  428. End Sub
  429. Sub DBNew_FoxPro_Click ()
  430.    gstDataType = "FoxPro 2.0"
  431.    NewLocalISAM
  432. End Sub
  433. Sub DBNew_ODBC_Click ()
  434.   Dim driver As String
  435.   On Error GoTo DBNErr
  436.   MsgBar "Enter New Database Parameters", False
  437.   'driver must be an valid entry in ODBCINST.INI
  438.   driver = InputBox("Enter Driver Name from ODBCINST.INI File:", "Driver Name", DEFAULTDRIVER)
  439.   RegisterDatabase "", driver, False, ""
  440.   SendKeys "%FOO"   'force open database dialog
  441.   GoTo DBNEnd
  442. DBNErr:
  443.   ShowError
  444.   Resume DBNEnd
  445. DBNEnd:
  446.   MsgBar "", False
  447. End Sub
  448. Sub DBNew_Paradox_Click ()
  449.    gstDataType = "Paradox 3.X"
  450.    NewLocalISAM
  451. End Sub
  452. Sub DBOpen_Access_Click ()
  453.    gstDataType = "MS Access"
  454.    OpenLocalDB False
  455. End Sub
  456. Sub DBOpen_Btrieve_Click ()
  457.    gstDataType = "Btrieve"
  458.    OpenLocalDB False
  459. End Sub
  460. Sub DBOpen_dBASE3_Click ()
  461.    gstDataType = "dBASE III"
  462.    OpenLocalDB False
  463. End Sub
  464. Sub DBOpen_dBASE4_Click ()
  465.    gstDataType = "dBASE IV"
  466.    OpenLocalDB False
  467. End Sub
  468. Sub DBOpen_Fox25_Click ()
  469.    gstDataType = "FoxPro 2.5"
  470.    OpenLocalDB False
  471. End Sub
  472. Sub DBOpen_FoxPro_Click ()
  473.    gstDataType = "FoxPro 2.0"
  474.    OpenLocalDB False
  475. End Sub
  476. Sub DBOpen_ODBC_Click ()
  477.    If gfDBOpenFlag = True Then
  478.      Call DBClose_Click
  479.    End If
  480.    If gfDBOpenFlag = True Then
  481.      Beep
  482.      MsgBox "You must Close First!", 48
  483.    Else
  484.      fOpenDB.Show MODAL
  485.    End If
  486.    If gfDBOpenFlag = True Then
  487.      DBProperties.Visible = True
  488.      DBClose.Visible = True
  489.      TblMenu.Visible = True
  490.      UtilMenu.Visible = True
  491.      RefreshTables fTables.cTableList, True
  492.      fSQL.CreateQueryDefbtn.Visible = False
  493.      TblAttach.Visible = False
  494.    End If
  495. End Sub
  496. Sub DBOpen_Paradox_Click ()
  497.    gstDataType = "Paradox 3.X"
  498.    OpenLocalDB False
  499. End Sub
  500. Sub DBProperties_Click ()
  501.    Dim f As New fDataBox
  502.    Dim s As String, t As String, erm As String
  503.    Dim i As Integer
  504.    On Error GoTo PropErr
  505.    f.Caption = gCurrentDB.Name + " Properties"
  506.    f.Tag = "DB"
  507.    erm = "Name"
  508.    f.cData.AddItem "Database Name = " + gCurrentDB.Name
  509.    erm = "Connect"
  510.    f.cData.AddItem "Connect String = " + gCurrentDB.Connect
  511.    erm = "Collating Order"
  512.    f.cData.AddItem "Collating Order = " + gCurrentDB.CollatingOrder
  513.    erm = "Updatable"
  514.    f.cData.AddItem "Updatable = " + stTrueFalse((gCurrentDB.Updatable))
  515.    erm = "Transactions"
  516.    f.cData.AddItem "Transactions = " + stTrueFalse((gCurrentDB.Transactions))
  517.    erm = "QueryTimeout"
  518.    f.cData.AddItem "Query Timeout = " & gCurrentDB.QueryTimeout & " seconds"
  519.    f.Show MODAL
  520.   GoTo DBPropEnd
  521. PropErr:
  522.   f.cData.AddItem erm + ":" + Error$
  523.   Resume Next
  524. DBPropEnd:
  525. End Sub
  526. Sub Exit_Click ()
  527.   Unload Me
  528. End Sub
  529. ' Updated per MS PSS Article Q115976 for Jet 2.0 (rbd 12/8/94)
  530. ' Fixed missing Paradox 4.X profile entry (rbd 12/29/94)
  531. Sub MDIForm_Load ()
  532.   Dim st As String
  533.   Dim x As Integer
  534.   Dim tmp As String
  535.   tmp = String$(255, 32)
  536.   'write ISAM entries in INI file just in case
  537.   x = OSWritePrivateProfileString("Installable ISAMS", "Paradox 3.X", "PDX200.DLL", "VISDATA.INI")
  538.   x = OSWritePrivateProfileString("Installable ISAMS", "Paradox 4.X", "PDX200.DLL", "VISDATA.INI")
  539.   x = OSWritePrivateProfileString("Installable ISAMS", "dBASE III", "XBS200.DLL", "VISDATA.INI")
  540.   x = OSWritePrivateProfileString("Installable ISAMS", "dBASE IV", "XBS200.DLL", "VISDATA.INI")
  541.   x = OSWritePrivateProfileString("Installable ISAMS", "FoxPro 2.0", "XBS200.DLL", "VISDATA.INI")
  542.   x = OSWritePrivateProfileString("Installable ISAMS", "FoxPro 2.5", "XBS200.DLL", "VISDATA.INI")
  543.   x = OSWritePrivateProfileString("Installable ISAMS", "Btrieve", "BTRV200.DLL", "VISDATA.INI")
  544.   x = OSWritePrivateProfileString("dBase ISAM", "Deleted", "On", "VISDATA.INI")
  545.   x = OSWritePrivateProfileString("Paradox ISAM", "ParadoxUserName", "User", "VISDATA.INI")
  546.   x = OSWritePrivateProfileString("Paradox ISAM", "ParadoxNetPath", "c:\vb\prdx", "VISDATA.INI")
  547.   ' Note: 4.x works with 3.x and 4.x net styles
  548.   x = OSWritePrivateProfileString("Paradox ISAM", "ParadoxNetStyle", "4.x", "VISDATA.INI")
  549.   x = OSWritePrivateProfileString("Paradox ISAM", "CollatingSequence", "Ascii", "VISDATA.INI")
  550.   x = OSGetWindowsDirectory(tmp, 255)
  551.   st = Mid$(tmp, 1, x)
  552.   SetDataAccessOption 1, st + "\visdata.ini"
  553.   SetDefaultWorkspace "admin", ""
  554.   gwMaxGridRows = Val(GetINIString("MaxRows", "250"))
  555.   glQueryTimeout = Val(GetINIString("QueryTimeout", "5"))
  556.   glLoginTimeout = Val(GetINIString("LoginTimeout", "20"))
  557.   st = GetINIString("ViewMode", "Single")
  558.   If UCase(st) = "SINGLE" Then
  559.     cSingleRecord = True
  560.   ElseIf UCase(st) = "DATACTL" Then
  561.     cDataCtl = True
  562.   Else
  563.     cTableView = True
  564.   End If
  565.   st = GetINIString("OpenOnStartup", "No")
  566.   If UCase(st) = "YES" Then
  567.     PrefOpenOnStartup.Checked = True
  568.   Else
  569.     PrefOpenOnStartup.Checked = False
  570.   End If
  571.   st = GetINIString("ShowPerf", "No")
  572.   If UCase(st) = "YES" Then
  573.     PrefShowPerf.Checked = True
  574.   Else
  575.     PrefShowPerf.Checked = False
  576.   End If
  577.   st = GetINIString("AllowSys", "No")
  578.   If UCase(st) = "YES" Then
  579.     PrefAllowSys.Checked = True
  580.   Else
  581.     PrefAllowSys.Checked = False
  582.   End If
  583.   ' Default to showing SQL (now that it can be clicked-to)
  584.   st = GetINIString("DisplaySQL", "Yes")
  585.   If UCase(st) = "YES" Then
  586.     PrefDisplaySQL.Checked = True
  587.   Else
  588.     PrefDisplaySQL.Checked = False
  589.   End If
  590.   'get the last used database out of the INI file
  591.   gstDataType = GetINIString("DataType", "")
  592.   gstDBName = GetINIString("Server", "")
  593.   gstDatabase = GetINIString("DataBase", "")
  594.   gstUserName = GetINIString("UserName", "")
  595.   gstPassword = GetINIString("Password", "")
  596.   If PrefOpenOnStartup.Checked = True Then
  597.     If gstDataType = "MS Access" Then
  598.       SendKeys "%FOM"
  599.     ElseIf gstDataType = "dBASE III" Then
  600.       SendKeys "%FOD"
  601.     ElseIf gstDataType = "dBASE IV" Then
  602.       SendKeys "%FOA"
  603.     ElseIf gstDataType = "FoxPro 2.0" Then
  604.       SendKeys "%FOF"
  605.     ElseIf gstDataType = "FoxPro 2.5" Then
  606.       SendKeys "%FOX"
  607.     ElseIf gstDataType = "Paradox 3.X" Then
  608.       SendKeys "%FOP"
  609.     ElseIf gstDataType = "Paradox 4.X" Then     ' New addition
  610.       SendKeys "%FOR"                           ' 'r' in word Paradox
  611.     ElseIf gstDataType = "Btrieve" Then
  612.       SendKeys "%FOB"
  613.     ElseIf gstDataType = "ODBC" Then
  614.       SendKeys "%FOO"
  615.     End If
  616.   End If
  617.   x = Val(GetINIString("WindowState", "2"))
  618.   If x <> 1 Then
  619.     WindowState = x
  620.   Else
  621.     WindowState = 0
  622.   End If
  623.   If x = 0 Then
  624.     x = Val(GetINIString("WindowLeft", "0"))
  625.     Left = x
  626.     x = Val(GetINIString("WindowTop", "0"))
  627.     Top = x
  628.     x = Val(GetINIString("WindowWidth", "9135"))
  629.     Width = x
  630.     x = Val(GetINIString("WindowHeight", "6900"))
  631.     Height = x
  632.   End If
  633.   Me.Show
  634.   fSQL.Show
  635. End Sub
  636. ' rbd - Fix INI for "see SQL Queries" vs "see System Tables"
  637. Sub MDIForm_QueryUnload (Cancel As Integer, UnloadMode As Integer)
  638.   Dim x As Integer
  639.   Dim st As String
  640.   On Error Resume Next
  641.   x = OSWritePrivateProfileString("VISDATA", "DataType", gstDataType, "VISDATA.INI")
  642.   x = OSWritePrivateProfileString("VISDATA", "Server", gstDBName, "VISDATA.INI")
  643.   x = OSWritePrivateProfileString("VISDATA", "DataBase", gstDatabase, "VISDATA.INI")
  644.   x = OSWritePrivateProfileString("VISDATA", "UserName", gstUserName, "VISDATA.INI")
  645.   x = OSWritePrivateProfileString("VISDATA", "Password", gstPassword, "VISDATA.INI")
  646.   If PrefOpenOnStartup.Checked = True Then
  647.     st = "Yes"
  648.   Else
  649.     st = "No"
  650.   End If
  651.   x = OSWritePrivateProfileString("VISDATA", "OpenOnStartup", st, "VISDATA.INI")
  652.   If PrefShowPerf.Checked = True Then
  653.     st = "Yes"
  654.   Else
  655.     st = "No"
  656.   End If
  657.   x = OSWritePrivateProfileString("VISDATA", "ShowPerf", st, "VISDATA.INI")
  658.   If PrefAllowSys.Checked = True Then
  659.     st = "Yes"
  660.   Else
  661.     st = "No"
  662.   End If
  663.   x = OSWritePrivateProfileString("VISDATA", "AllowSys", st, "VISDATA.INI")
  664.   If PrefDisplaySQL.Checked = True Then
  665.     st = "Yes"
  666.   Else
  667.     st = "No"
  668.   End If
  669.   x = OSWritePrivateProfileString("VISDATA", "DisplaySQL", st, "VISDATA.INI")
  670.   x = OSWritePrivateProfileString("VISDATA", "WindowState", CStr(WindowState), "VISDATA.INI")
  671.   If WindowState <> 2 Then
  672.     x = OSWritePrivateProfileString("VISDATA", "WindowTop", CStr(Top), "VISDATA.INI")
  673.     x = OSWritePrivateProfileString("VISDATA", "WindowLeft", CStr(Left), "VISDATA.INI")
  674.     x = OSWritePrivateProfileString("VISDATA", "WindowWidth", CStr(Width), "VISDATA.INI")
  675.     x = OSWritePrivateProfileString("VISDATA", "WindowHeight", CStr(Height), "VISDATA.INI")
  676.   End If
  677.   x = OSWritePrivateProfileString("VISDATA", "MaxRows", CStr(gwMaxGridRows), "VISDATA.INI")
  678.   x = OSWritePrivateProfileString("VISDATA", "QueryTimeout", CStr(glQueryTimeout), "VISDATA.INI")
  679.   x = OSWritePrivateProfileString("VISDATA", "LoginTimeout", CStr(glLoginTimeout), "VISDATA.INI")
  680.   If VDMDI.cSingleRecord = True Then
  681.     st = "Single"
  682.   ElseIf VDMDI.cDataCtl = True Then
  683.     st = "DataCtl"
  684.   Else
  685.     st = "Table"
  686.   End If
  687.   x = OSWritePrivateProfileString("VISDATA", "ViewMode", st, "VISDATA.INI")
  688.   x = OSWritePrivateProfileString("VISDATA", "SQLStatement", fSQL.cSQLStatement, "VISDATA.INI")
  689.   If fSQL.WindowState <> 1 Then
  690.     x = OSWritePrivateProfileString("VISDATA", "SQLWindowTop", CStr(fSQL.Top), "VISDATA.INI")
  691.     x = OSWritePrivateProfileString("VISDATA", "SQLWindowLeft", CStr(fSQL.Left), "VISDATA.INI")
  692.     x = OSWritePrivateProfileString("VISDATA", "SQLWindowWidth", CStr(fSQL.Width), "VISDATA.INI")
  693.     x = OSWritePrivateProfileString("VISDATA", "SQLWindowHeight", CStr(fSQL.Height), "VISDATA.INI")
  694.   End If
  695.   If gfDBChanged Then
  696.     If MsgBox("Data has been changed, Commit it?", MSGBOX_TYPE) = YES Then
  697.       gCurrentDB.CommitTrans
  698.     End If
  699.   End If
  700.   CloseAllDynasets
  701.   If gfDBOpenFlag Then gCurrentDB.Close
  702.   End
  703. End Sub
  704. Sub New_paradox4x_Click ()
  705.     gstDataType = "Paradox 4.X"
  706.     NewLocalISAM
  707. End Sub
  708. Sub NewLocalISAM ()
  709.    Dim nn As String
  710.    Dim d As Database
  711.    On Error GoTo NewISAMErr
  712.    nn = InputBox("Enter Name for New ISAM Database:")
  713.    If nn = "" Then Exit Sub
  714.    If Mid(nn, Len(nn), 1) <> "\" Then nn = nn + "\"
  715.    MkDir Mid(nn, 1, Len(nn) - 1)
  716.    gstDBName = nn
  717.    OpenLocalDB True
  718.    If gfDBOpenFlag = True Then
  719.      DBProperties.Visible = True
  720.      DBClose.Visible = True
  721.      TblMenu.Visible = True
  722.      UtilMenu.Visible = True
  723.      RefreshTables fTables.cTableList, True
  724.      fSQL.CreateQueryDefbtn.Visible = True
  725.      TblAttach.Visible = True
  726.    End If
  727.   GoTo NewISAMEnd
  728. NewISAMErr:
  729.   If Err = 75 Then Resume Next  'catch the case where dir exists
  730.   ShowError
  731.   Resume NewISAMEnd
  732. NewISAMEnd:
  733. End Sub
  734. Sub Open_paradox4x_Click ()
  735.     gstDataType = "Paradox 4.X"
  736.     OpenLocalDB False
  737. End Sub
  738. ' Updated per MS PSS Article Q115976 for Jet 2.0 (rbd 12/8/94)
  739. Sub OpenLocalDB (doit As Integer)
  740.    Dim Connect As String, DataBaseName As String
  741.    On Error GoTo OpenError
  742.    If gfDBOpenFlag = True Then
  743.      Call DBClose_Click
  744.    End If
  745.    If gfDBOpenFlag = True Then
  746.      Beep
  747.      MsgBox "You must Close First!", 48
  748.      Exit Sub
  749.    Else
  750.      Select Case gstDataType
  751.        Case "MS Access"
  752.          CMD1.Filter = "Access DBs (*.mdb)|*.mdb|All Files (*.*)|*.*"
  753.          CMD1.DialogTitle = "Open MS Access Database"
  754.        Case "dBASE III"
  755.          CMD1.Filter = "dBASE III DBs (*.dbf)|*.dbf"
  756.          CMD1.DialogTitle = "Open dBASE III Database"
  757.        Case "dBASE IV"
  758.          CMD1.Filter = "dBASE IV DBs (*.dbf)|*.dbf"
  759.          CMD1.DialogTitle = "Open dBASE IV Database"
  760.        Case "FoxPro 2.0"
  761.          CMD1.Filter = "FoxPro DBs (*.dbf)|*.dbf"
  762.          CMD1.DialogTitle = "Open FoxPro 2.0 Database"
  763.        Case "FoxPro 2.5"
  764.          CMD1.Filter = "FoxPro DBs (*.dbf)|*.dbf"
  765.          CMD1.DialogTitle = "Open FoxPro 2.5 Database"
  766.        Case "Paradox 3.X"
  767.          CMD1.Filter = "Paradox DBs (*.db)|*.db"
  768.          CMD1.DialogTitle = "Open Paradox 3.X Database"
  769.        Case "Paradox 4.X"                               ' New addition
  770.          CMD1.Filter = "Paradox DBs (*.db)|*.db"
  771.          CMD1.DialogTitle = "Open Paradox 4.X Database"
  772.        Case "Btrieve"
  773.          CMD1.Filter = "Btrieve DBs (FILE.DDF)|FILE.DDF"
  774.          CMD1.DialogTitle = "Open Btrieve Database"
  775.      End Select
  776.      CMD1.FilterIndex = 1
  777.      CMD1.Filename = gstDBName  '""
  778.      CMD1.CancelError = True
  779.      If doit = False Then
  780.        CMD1.Action = 1
  781.        If CMD1.Filename <> "" Then
  782.          gstDBName = CMD1.Filename
  783.        Else
  784.          Exit Sub
  785.        End If
  786.      End If
  787.    End If
  788.    MsgBar "Opening DataBase", True
  789.    SetHourglass Me
  790.    Select Case gstDataType
  791.      Case "dBASE III"
  792.        Connect = "dBASE III"
  793.        DataBaseName = StripFileName(gstDBName)
  794.      Case "dBASE IV"
  795.        Connect = "dBASE IV"
  796.        DataBaseName = StripFileName(gstDBName)
  797.      Case "FoxPro 2.0"
  798.        Connect = "FoxPro 2.0"
  799.        DataBaseName = StripFileName(gstDBName)
  800.      Case "FoxPro 2.5"
  801.        Connect = "FoxPro 2.5"
  802.        DataBaseName = StripFileName(gstDBName)
  803.      Case "Paradox 3.X"
  804.        Connect = "Paradox 3.X"
  805.        DataBaseName = StripFileName(gstDBName)
  806.      Case "Paradox 4.X"                             ' New addition
  807.        Connect = "Paradox 4.X"
  808.        DataBaseName = StripFileName(gstDBName)
  809.      Case "Btrieve"
  810.        Connect = "Btrieve;"
  811.        DataBaseName = gstDBName
  812.      Case Else
  813.        Connect = ""
  814.        DataBaseName = gstDBName
  815.    End Select
  816.    Set gCurrentDB = OpenDatabase(DataBaseName, False, False, Connect)
  817.    If gfDBOpenFlag = True Then
  818.      CloseAllDynasets
  819.    End If
  820.    gfTransPending = False
  821.    VDMDI.ToolBar.Visible = True
  822.    VDMDI.QueryBuilder.Visible = True
  823.    fTables.Caption = gstDBName
  824.    gCurrentDB.QueryTimeout = glQueryTimeout
  825.    'success
  826.    gfDBOpenFlag = True
  827.    DBProperties.Visible = True
  828.    DBClose.Visible = True
  829.    TblMenu.Visible = True
  830.    UtilMenu.Visible = True
  831.    RefreshTables fTables.cTableList, True
  832.    If gstDataType = "MS Access" Then
  833.      fSQL.CreateQueryDefbtn.Visible = True
  834.      TblAttach.Visible = True
  835.      fTables.TableListLabel = "Tables/Queries:"
  836.    Else
  837.      TblAttach.Visible = False
  838.      fSQL.CreateQueryDefbtn.Visible = False
  839.    End If
  840.    ResetMouse Me
  841.    GoTo OpenEnd
  842. OpenError:
  843.    ResetMouse Me
  844.    gfDBOpenFlag = False
  845.    gstDBName = ""
  846.    gstDataType = ""
  847.    If Err <> 32755 Then     'check for common dialog cancelled
  848.      ShowError
  849.    End If
  850.    Resume OpenEnd
  851. OpenEnd:
  852. End Sub
  853. Sub PrefAllowSys_Click ()
  854.   If PrefAllowSys.Checked = True Then
  855.     PrefAllowSys.Checked = False
  856.   Else
  857.     PrefAllowSys.Checked = True
  858.   End If
  859.   RefreshTables fTables.cTableList, True
  860. End Sub
  861. Sub PrefDisplaySQL_Click ()
  862.   If PrefDisplaySQL.Checked = True Then
  863.     PrefDisplaySQL.Checked = False
  864.   Else
  865.     PrefDisplaySQL.Checked = True
  866.   End If
  867. End Sub
  868. Sub PrefLoginTimeout_Click ()
  869.   On Error GoTo LTErr
  870.   Dim nval As String
  871.   nval = InputBox("Login Timeout is currently " & glLoginTimeout & " seconds." + Chr(13) + Chr(10) + "Enter New Value:")
  872.   If nval = "" Then Exit Sub
  873.   'try to set the new value
  874.   If Val(nval) >= 0 Then
  875.     glLoginTimeout = Val(nval)
  876.   End If
  877.   GoTo LTEnd
  878. LTErr:
  879.   ShowError
  880.   Resume LTEnd
  881. LTEnd:
  882. End Sub
  883. Sub PrefMaxRows_Click ()
  884.   Dim st As String
  885.   Dim CR As String
  886.   MsgBar "Enter Maximum Rows to Show in Grid", False
  887.   st = InputBox("Enter New Value:", "Max Grid View Rows", CStr(gwMaxGridRows))
  888.   If st <> "" Then
  889.     If Val(st) > MAX_GRID_ROWS Then
  890.       MsgBox "Maximum Rows is " + CStr(MAX_GRID_ROWS), 48
  891.       gwMaxGridRows = MAX_GRID_ROWS
  892.     ElseIf Val(st) = 0 Then
  893.       MsgBox "Minimum Rows is 1.", 48
  894.       gwMaxGridRows = 1
  895.     Else
  896.       gwMaxGridRows = Val(st)
  897.     End If
  898.   End If
  899.   MsgBar "", False
  900. End Sub
  901. Sub PrefOpenOnStartup_Click ()
  902.   'toggle the menu item
  903.   If PrefOpenOnStartup.Checked = True Then
  904.     PrefOpenOnStartup.Checked = False
  905.   Else
  906.     PrefOpenOnStartup.Checked = True
  907.   End If
  908. End Sub
  909. Sub PrefQueryTimeout_Click ()
  910.   On Error GoTo QTErr
  911.   Dim nval As String
  912.   nval = InputBox("Query Timeout is currently " & gCurrentDB.QueryTimeout & " seconds." + Chr(13) + Chr(10) + "Enter New Value:")
  913.   If nval = "" Then Exit Sub
  914.   'try to set the new value
  915.   gCurrentDB.QueryTimeout = Val(nval)
  916.   glQueryTimeout = Val(nval)
  917.   GoTo QTEnd
  918. QTErr:
  919.   ShowError
  920.   'reset the form control after the error
  921.   glQueryTimeout = gCurrentDB.QueryTimeout
  922.   Resume QTEnd
  923. QTEnd:
  924. End Sub
  925. Sub PrefShowPerf_Click ()
  926.   If PrefShowPerf.Checked = True Then
  927.     PrefShowPerf.Checked = False
  928.   Else
  929.     PrefShowPerf.Checked = True
  930.   End If
  931. End Sub
  932. Sub QueryBuilder_Click ()
  933.   fQuery.WindowState = 0
  934. End Sub
  935. Sub RollBackButton_Click ()
  936.   On Error GoTo RollbackErr
  937.   If MsgBox("All changes will be gone, Rollback anyway?", MSGBOX_TYPE) = YES Then
  938.     gCurrentDB.Rollback
  939.     gfDBChanged = False
  940.     gfTransPending = False
  941.     BeginButton.Visible = True
  942.     CommitButton.Visible = False
  943.     RollBackButton.Visible = False
  944.     BeginButton.SetFocus
  945.   End If
  946.   GoTo DBRollbackEnd
  947. RollbackErr:
  948.   ShowError
  949.   Resume DBRollbackEnd
  950. DBRollbackEnd:
  951. End Sub
  952. Sub TblAttach_Click ()
  953.   fAttach.Show MODAL
  954. End Sub
  955. Sub TblCopyStruct_Click ()
  956.   fCpyStru.Show MODAL
  957. End Sub
  958. Sub TblDelete_Click ()
  959.   On Error GoTo TblDelErr
  960.   If fTables.cTableList = "" Then
  961.     MsgBox "No Table Selected", 48
  962.     Exit Sub
  963.   End If
  964.   If MsgBox("Delete """ + fTables.cTableList + """ table?", MSGBOX_TYPE) = YES Then
  965.     If TableType((fTables.cTableList)) = DB_QUERYDEF Then
  966.       gCurrentDB.DeleteQueryDef (fTables.cTableList)
  967.     Else
  968.       gCurrentDB.TableDefs.Delete gCurrentDB.TableDefs(fTables.cTableList)
  969.     End If
  970.     fTables.cTableList.RemoveItem fTables.cTableList.ListIndex
  971.   End If
  972.   GoTo TblDelEnd
  973. TblDelErr:
  974.   ShowError
  975.   Resume TblDelEnd
  976. TblDelEnd:
  977. End Sub
  978. Sub TblProperties_Click ()
  979.    Dim f As New fDataBox
  980.    Dim erm As String
  981.    Dim tt As Integer
  982.    Dim qt As String
  983.    Dim qd As querydef
  984.    If fTables.cTableList = "" Then
  985.      MsgBox "No Table Selected", 48
  986.      Exit Sub
  987.    End If
  988.    On Error GoTo TblPropErr
  989.    f.Caption = fTables.cTableList + " Properties"
  990.    tt = TableType((fTables.cTableList))
  991.    If tt = DB_QUERYDEF Then
  992.      f.cData.AddItem "Table Type = QueryDef"
  993.    ElseIf tt = DB_ATTACHEDTABLE Then
  994.      f.cData.AddItem "Table Type = Attached Table"
  995.    ElseIf tt = DB_ATTACHEDODBC Then
  996.      f.cData.AddItem "Table Type = Attached ODBC Table"
  997.    Else
  998.      f.cData.AddItem "Table Type = Table"
  999.    End If
  1000.    If tt = DB_QUERYDEF Then
  1001.      f.Tag = "QD"
  1002.      Set gCurrentQueryDef = gCurrentDB.OpenQueryDef(fTables.cTableList)
  1003.      erm = "Name"
  1004.      f.cData.AddItem "QueryDef Name = " + gCurrentQueryDef.Name
  1005.      erm = "SQL"
  1006.      f.cData.AddItem "SQL = " + gCurrentQueryDef.SQL
  1007.      qt = ActionQueryType((fTables.cTableList))
  1008.      If qt <> "" Then
  1009.        f.cData.AddItem "Action Query Type = " + qt
  1010.      End If
  1011.      f.Show MODAL
  1012.      gCurrentQueryDef.Close
  1013.    Else
  1014.      f.Tag = "TBD"
  1015.      erm = "Name"
  1016.      f.cData.AddItem "Table Name = " + gCurrentDB.TableDefs(fTables.cTableList).Name
  1017.      erm = "Date Created"
  1018.      f.cData.AddItem "Date Created = " & gCurrentDB.TableDefs(fTables.cTableList).DateCreated
  1019.      erm = "Last Updated"
  1020.      f.cData.AddItem "Last Updated = " & gCurrentDB.TableDefs(fTables.cTableList).LastUpdated
  1021.      erm = "Updatable"
  1022.      f.cData.AddItem "Updatable = " + stTrueFalse((gCurrentDB.TableDefs(fTables.cTableList).Updatable))
  1023.      erm = "Connect"
  1024.      f.cData.AddItem "Connect String = " + gCurrentDB.TableDefs(fTables.cTableList).Connect
  1025.      erm = "Source Table Name"
  1026.      f.cData.AddItem "Source Table Name = " + gCurrentDB.TableDefs(fTables.cTableList).SourceTableName
  1027.      erm = "Attributes"
  1028.      f.cData.AddItem "Attributes = &H" & Hex(gCurrentDB.TableDefs(fTables.cTableList).Attributes)
  1029.      f.Show MODAL
  1030.    End If
  1031.   GoTo TblPropEnd
  1032. TblPropErr:
  1033.   f.cData.AddItem erm + ":" + Error$
  1034.   Resume Next
  1035. TblPropEnd:
  1036. End Sub
  1037. Sub TblRefresh_Click ()
  1038.   gCurrentDB.TableDefs.Refresh
  1039.   RefreshTables fTables.cTableList, True
  1040. End Sub
  1041. Sub TblZap_Click ()
  1042.   Dim RetSQL As Long
  1043.   If fTables.cTableList = "" Then
  1044.     MsgBox "No Table Selected", 48
  1045.     Exit Sub
  1046.   End If
  1047.   On Error GoTo ZapErr
  1048.   If MsgBox("Delete All Records in " + fTables.cTableList + "?", MSGBOX_TYPE) = YES Then
  1049.     'delete all rows with a sql statement
  1050.     If gstDataType = "ODBC" Then
  1051.       RetSQL = gCurrentDB.ExecuteSQL("delete from " + fTables.cTableList)
  1052.       If RetSQL > 0 Then
  1053.         MsgBox CStr(RetSQL) + " rows deleted!", 48
  1054.         If gfTransPending Then gfDBChanged = True
  1055.       End If
  1056.     Else
  1057.       gCurrentDB.Execute ("delete from " + fTables.cTableList)
  1058.     End If
  1059.   End If
  1060.   GoTo ZapEnd
  1061. ZapErr:
  1062.   If Err = EOF_ERR Then Resume Next
  1063.   ShowError
  1064.   Resume ZapEnd
  1065. ZapEnd:
  1066. End Sub
  1067. Sub UtilCloseAll_Click ()
  1068.   CloseAllDynasets
  1069. End Sub
  1070. Sub UtilCompactDB_Click ()
  1071.    Dim oldname As String, newname As String
  1072.    On Error GoTo CompactAccErr
  1073.    'get file name to compact
  1074.    CMD1.Filter = "Access DBs (*.mdb)|*.mdb|All Files (*.*)|*.*"
  1075.    CMD1.DialogTitle = "Open MS Access Database to Compact"
  1076.    CMD1.FilterIndex = 1
  1077.    CMD1.Action = 1
  1078.    If CMD1.Filename <> "" Then
  1079.      oldname = CMD1.Filename
  1080.    Else
  1081.      Exit Sub
  1082.    End If
  1083.    'get file name to compact to
  1084.    CMD1.DialogTitle = "Select MS Access Database to Compact to"
  1085.    CMD1.FilterIndex = 1
  1086.    CMD1.Action = 2
  1087.    If CMD1.Filename <> "" Then
  1088.      newname = CMD1.Filename
  1089.    Else
  1090.      Exit Sub
  1091.    End If
  1092.    SetHourglass Me
  1093.    MsgBar "Compacting " + oldname + " to " + newname, True
  1094.    CompactDatabase oldname, newname, DB_CREATE_GENERAL, DB_VERSION10
  1095.    MsgBar "", False
  1096.    ResetMouse Me
  1097.    If MsgBox("Open Newly Compacted Database?", MSGBOX_TYPE) = YES Then
  1098.      If gfDBOpenFlag = True Then
  1099.        Call DBClose_Click
  1100.      End If
  1101.      gstDataType = "MS Access"
  1102.      gstDBName = newname
  1103.      OpenLocalDB True
  1104.    End If
  1105.    If gfDBOpenFlag = True Then
  1106.      DBProperties.Visible = True
  1107.      DBClose.Visible = True
  1108.      TblMenu.Visible = True
  1109.      UtilMenu.Visible = True
  1110.      RefreshTables fTables.cTableList, True
  1111.      fSQL.CreateQueryDefbtn.Visible = True
  1112.      TblAttach.Visible = True
  1113.    End If
  1114.   GoTo CompactAccEnd
  1115. CompactAccErr:
  1116.   MsgBar "", False
  1117.   ResetMouse Me
  1118.   ShowError
  1119.   Resume CompactAccEnd
  1120. CompactAccEnd:
  1121. End Sub
  1122. Sub UtilExport_Click ()
  1123.   Dim ds As Dynaset
  1124.   Dim l As Long
  1125.   Dim i As Integer
  1126.   Dim fn As String
  1127.   Dim st As String
  1128.   On Error GoTo ExportErr
  1129.   If fTables.cTableList = "" And UCase(Mid(fSQL.cSQLStatement, 1, 6)) <> "SELECT" Then
  1130.     MsgBox "No Table Selected", 48
  1131.     Exit Sub
  1132.   End If
  1133.   fn = InputBox("Enter Path\FileName to Export to:", "Export File", "VISDATA.TXT")
  1134.   If fn = "" Then Exit Sub
  1135.   SetHourglass Me
  1136.   MsgBar "Exporting Data to " + fn, True
  1137.   If UCase(Mid(fSQL.cSQLStatement, 1, 6)) = "SELECT" Then
  1138.     Set ds = gCurrentDB.CreateDynaset(fSQL.cSQLStatement)
  1139.   Else
  1140.     Set ds = gCurrentDB.CreateDynaset(fTables.cTableList)
  1141.   End If
  1142.   Open fn For Output As #1
  1143.   'output the field names
  1144.   st = Chr$(9)
  1145.   For i = 0 To ds.Fields.Count - 1
  1146.     st = st + ds(i).Name + Chr$(9)
  1147.   Next
  1148.   Print #1, st
  1149.   'output the field contents
  1150.   l = 1
  1151.   While ds.EOF = False
  1152.     st = CStr(l) + Chr$(9)
  1153.     For i = 0 To ds.Fields.Count - 1
  1154.       st = st + vFieldVal((ds(i))) + Chr$(9)
  1155.     Next
  1156.     Print #1, st
  1157.     ds.MoveNext
  1158.     l = l + 1
  1159.   Wend
  1160.   GoTo ExportEnd
  1161. ExportErr:
  1162.   ShowError
  1163.   Resume ExportEnd
  1164. ExportEnd:
  1165.   Close #1
  1166.   ResetMouse Me
  1167.   MsgBar "", False
  1168. End Sub
  1169. Sub UtilRepairDB_Click ()
  1170.    On Error GoTo RepairAccErr
  1171.    Dim nn As String
  1172.    'get file name to repair
  1173.    CMD1.Filter = "Access DBs (*.mdb)|*.mdb|All Files (*.*)|*.*"
  1174.    CMD1.DialogTitle = "Open MS Access Database to Repair"
  1175.    CMD1.FilterIndex = 1
  1176.    CMD1.Action = 1
  1177.    If CMD1.Filename <> "" Then
  1178.      nn = CMD1.Filename
  1179.    Else
  1180.      Exit Sub
  1181.    End If
  1182.    SetHourglass Me
  1183.    MsgBar "Repairing " + nn, True
  1184.    RepairDatabase nn
  1185.    ResetMouse Me
  1186.    MsgBar "", False
  1187.    If MsgBox("Open Repaired Database?", MSGBOX_TYPE) = YES Then
  1188.      If gfDBOpenFlag = True Then
  1189.        Call DBClose_Click
  1190.      End If
  1191.      gstDataType = "MS Access"
  1192.      gstDBName = nn
  1193.      OpenLocalDB True
  1194.    End If
  1195.    If gfDBOpenFlag = True Then
  1196.      DBProperties.Visible = True
  1197.      DBClose.Visible = True
  1198.      TblMenu.Visible = True
  1199.      UtilMenu.Visible = True
  1200.      RefreshTables fTables.cTableList, True
  1201.      fSQL.CreateQueryDefbtn.Visible = True
  1202.      TblAttach.Visible = True
  1203.    End If
  1204.   GoTo RepairAccEnd
  1205. RepairAccErr:
  1206.   ResetMouse Me
  1207.   MsgBar "", False
  1208.   ShowError
  1209.   Resume RepairAccEnd
  1210. RepairAccEnd:
  1211. End Sub
  1212. Sub UtilReplace_Click ()
  1213.   Dim i As Integer
  1214.   Dim sb As String
  1215.   On Error GoTo ReplaceErr
  1216.   RefreshTables fReplace.cTableList, False
  1217.   fReplace.Show MODAL
  1218.   GoTo ReplaceEnd
  1219. ReplaceErr:
  1220.   ShowError
  1221.   Resume ReplaceEnd
  1222. ReplaceEnd:
  1223. End Sub
  1224. Sub WinArrange_Click ()
  1225.   Me.Arrange 3
  1226. End Sub
  1227. Sub WinCascade_Click ()
  1228.   Me.Arrange 0
  1229. End Sub
  1230. Sub WinSQL_Click ()
  1231.   fSQL.WindowState = 0
  1232. End Sub
  1233. Sub WinTables_Click ()
  1234.   fTables.WindowState = 0
  1235.   If fTables.cTableList.ListCount = 0 And gfDBOpenFlag = True Then
  1236.     RefreshTables fTables.cTableList, True
  1237.   End If
  1238. End Sub
  1239. Sub WinTile_Click ()
  1240.   Me.Arrange 2
  1241. End Sub
  1242.