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