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

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