home *** CD-ROM | disk | FTP | other *** search
/ On Hand / On_Hand_From_Softbank_1994_Release_2_Disc_2_1994.iso / 00202 / s / disk4 / dynagrid.fr_ / dynagrid.bin
Text File  |  1993-04-28  |  18KB  |  681 lines

  1. VERSION 2.00
  2. Begin Form fGridFrm 
  3.    BackColor       =   &H00C0C0C0&
  4.    ClientHeight    =   3105
  5.    ClientLeft      =   930
  6.    ClientTop       =   3585
  7.    ClientWidth     =   6690
  8.    Height          =   3510
  9.    Icon            =   DYNAGRID.FRX:0000
  10.    Left            =   870
  11.    LinkTopic       =   "Form1"
  12.    MDIChild        =   -1  'True
  13.    ScaleHeight     =   3096
  14.    ScaleMode       =   0  'User
  15.    ScaleWidth      =   6708
  16.    Tag             =   "Dynaset"
  17.    Top             =   3240
  18.    Width           =   6810
  19.    Begin Grid cGrid 
  20.       FixedCols       =   0
  21.       FixedRows       =   0
  22.       Height          =   2412
  23.       Left            =   0
  24.       TabIndex        =   0
  25.       Top             =   480
  26.       Width           =   6732
  27.    End
  28.    Begin PictureBox ViewButtons 
  29.       BackColor       =   &H00C0C0C0&
  30.       BorderStyle     =   0  'None
  31.       Height          =   375
  32.       Left            =   0
  33.       ScaleHeight     =   372
  34.       ScaleMode       =   0  'User
  35.       ScaleWidth      =   5171.607
  36.       TabIndex        =   1
  37.       Top             =   24
  38.       Width           =   5175
  39.       Begin CommandButton SortButton 
  40.          Caption         =   "&Sort"
  41.          Height          =   372
  42.          Left            =   3720
  43.          TabIndex        =   9
  44.          Top             =   0
  45.          Width           =   612
  46.       End
  47.       Begin CommandButton FilterButton 
  48.          Caption         =   "Fil&ter"
  49.          Height          =   372
  50.          Left            =   3120
  51.          TabIndex        =   8
  52.          Top             =   0
  53.          Width           =   612
  54.       End
  55.       Begin CommandButton RefreshButton 
  56.          Caption         =   "&Redo"
  57.          Height          =   372
  58.          Left            =   2520
  59.          TabIndex        =   7
  60.          Top             =   0
  61.          Width           =   612
  62.       End
  63.       Begin CommandButton CloseButton 
  64.          Cancel          =   -1  'True
  65.          Caption         =   "&Close"
  66.          Height          =   372
  67.          Left            =   4320
  68.          TabIndex        =   6
  69.          Top             =   0
  70.          Width           =   612
  71.       End
  72.       Begin CommandButton MoreButton 
  73.          Caption         =   "&More"
  74.          Height          =   372
  75.          Left            =   1320
  76.          TabIndex        =   5
  77.          Top             =   0
  78.          Width           =   612
  79.       End
  80.       Begin CommandButton NextButton 
  81.          Caption         =   "&Next"
  82.          Height          =   372
  83.          Left            =   120
  84.          TabIndex        =   4
  85.          Top             =   0
  86.          Width           =   612
  87.       End
  88.       Begin CommandButton FirstButton 
  89.          Caption         =   "&First"
  90.          Height          =   372
  91.          Left            =   720
  92.          TabIndex        =   3
  93.          Top             =   0
  94.          Width           =   612
  95.       End
  96.       Begin CommandButton FindButton 
  97.          Caption         =   "F&ind"
  98.          Height          =   372
  99.          Left            =   1920
  100.          TabIndex        =   2
  101.          Top             =   0
  102.          Width           =   612
  103.       End
  104.    End
  105. End
  106. Option Explicit
  107.  
  108. 'form variables
  109. 'Dim FDS As dynaset         'current form's dynaset
  110. Dim FDS As snapshot        'current form's snapshot
  111. Dim FDynSt As String       'dynaset open string
  112. Dim FTblName As String     'form dynaset table name
  113. Dim FCurrentRow As Long    'current row in dynaset
  114. Dim FGridRow As Integer    'current grid row
  115. Dim FNotFound As Integer   'find not found flag
  116. Dim FFindForm As New fFind 'find form
  117. Dim FNumbRows As Long      'total number of rows in table
  118. Dim FDynaString As String  'dynaset open string
  119.  
  120. Sub cGrid_DblClick ()
  121.   Dim r As Integer       'return from execute sql
  122.   Dim fn As String       'field name
  123.  
  124.   On Error GoTo ZoomErr
  125.   r = cGrid.Row
  126.   cGrid.Row = 0
  127.   'get field name
  128.   fn = cGrid.Text
  129.   cGrid.Row = r
  130.  
  131.   'make sure it's a string or memo field
  132.   If FDS(fn).Type = FT_STRING Or FDS(fn).Type = FT_MEMO Then
  133.      gstZoomData = cGrid.Text
  134.      fZoom.Caption = fn
  135.      fZoom.Top = Top + 1200
  136.      fZoom.Left = Left + 250
  137.      fZoom.CloseZoomButton.Visible = True
  138.      fZoom.Show MODAL
  139.   End If
  140.   GoTo ZoomEnd
  141.  
  142. ZoomErr:
  143.   ShowError
  144.   Resume ZoomEnd
  145.  
  146. ZoomEnd:
  147.  
  148. End Sub
  149.  
  150. Sub cGrid_KeyUp (KeyCode As Integer, Shift As Integer)
  151.   'zoom on F4 key press
  152.   If KeyCode = &H73 Then   'F4
  153.     cGrid_DblClick
  154.   End If
  155. End Sub
  156.  
  157. Sub CloseButton_Click ()
  158.   Unload Me
  159. End Sub
  160.  
  161. Sub FilterButton_Click ()
  162.   On Error GoTo FilterErr
  163.  
  164. '  Dim ds1 As dynaset, ds2 As dynaset
  165.   Dim ds1 As snapshot, ds2 As snapshot
  166.   Dim FilterStr As String
  167.   Dim numbrows As Long    'local number of rows
  168.  
  169.   Set ds1 = FDS            'save the dynaset
  170.   
  171.   FilterStr = InputBox("Enter Filter Expression:")
  172.   If FilterStr = "" Then Exit Sub
  173.  
  174.   FDS.Filter = FilterStr
  175. '  Set ds2 = FDS.CreateDynaset()            'establish the filter
  176.   Set ds2 = FDS.CreateSnapshot()            'establish the filter
  177.   Set FDS = ds2            'assign back to original dynaset object
  178.  
  179.   'everything must be okay so redisplay form on 1st record
  180.   FNumbRows = GetNumbRecsSS(FDS)          'query numb of recs
  181.    If FNumbRows = -1 Then
  182.      'error occurred but go on anyway
  183.      'because row count is non-critical
  184.      Caption = "Dynaset: " + FTblName
  185.      numbrows = gwMaxGridRows
  186.      FCurrentRow = numbrows
  187.    ElseIf FNumbRows = 0 Then
  188.      Beep
  189.      MsgBox "No Records found!", 48
  190.      Unload Me
  191.      Exit Sub
  192.    ElseIf FNumbRows > gwMaxGridRows Then
  193.      Caption = "Dynaset: " + FTblName + " [" + CStr(FNumbRows) + " total rows]"
  194.      numbrows = gwMaxGridRows
  195.      FCurrentRow = numbrows
  196.    Else
  197.      numbrows = FNumbRows
  198.      Caption = "Dynaset: " + FTblName + " [" + CStr(FNumbRows) + " rows]"
  199.    End If
  200.   If LoadGrid(cGrid, FDS, FDynSt, numbrows, 0) = False Then
  201.     Unload Me
  202.     Exit Sub
  203.   End If
  204.   GoTo FilterEnd
  205.  
  206. FilterErr:
  207.   ShowError
  208.   Set FDS = ds1            're-assign back to original
  209.   Resume FilterEnd
  210.  
  211. FilterEnd:
  212.  
  213. End Sub
  214.  
  215. Sub FindButton_Click ()
  216.    Dim i As Integer, r As Integer, c As Integer
  217.  
  218.    On Error GoTo FindErr
  219.  
  220.    'load the column names into the find form
  221.    'the 1st time it is loaded
  222.    If FFindForm.cFieldList.ListCount = 0 Then
  223.      FFindForm.cFieldList.Clear
  224.      r = cGrid.Row
  225.      c = cGrid.Col
  226.      cGrid.Row = 0
  227.      cGrid.Col = 0
  228.      For i = 1 To cGrid.Cols - 1
  229.        cGrid.Col = cGrid.Col + 1
  230.        FFindForm.cFieldList.AddItem cGrid.Text
  231.      Next
  232.      cGrid.Row = r
  233.      cGrid.Col = c
  234.    End If
  235.  
  236. FindStart:       'used to loop around on not found
  237.  
  238.    'reset the flags
  239.    gfFindFailed = False
  240.    gfFromTableView = True
  241.  
  242.    MsgBar "Enter Search Parameters", False
  243.  
  244.    FFindForm.Show MODAL
  245.   
  246.    MsgBar "Searching for record", True
  247.  
  248.    If gfFindFailed = True Then Exit Sub
  249.  
  250.    FNotFound = False
  251.  
  252.    SetHourglass Me
  253.  
  254.    'search for the record
  255.    cGrid.SetFocus        'start at the top
  256.    SendKeys "^{Home}"
  257.    cGrid.Col = 1
  258.    cGrid.Row = 0
  259.    'move the right column
  260.    While cGrid.Text <> UCase(gstFindField)
  261.      If cGrid.Col = cGrid.Cols Then 'reached max col
  262.      Else
  263.        cGrid.Col = cGrid.Col + 1
  264.        SendKeys "{Right}"
  265.      End If
  266.    Wend
  267.    cGrid.Row = 1
  268.    While cGrid.Row < cGrid.Rows - 1
  269.        If gfFindMatch = False Then
  270.          Select Case gstFindOp
  271.            Case "="
  272.              If UCase(cGrid.Text) = UCase(gstFindExpr) Then GoTo AfterWhile
  273.            Case "<>"
  274.              If UCase(cGrid.Text) <> UCase(gstFindExpr) Then GoTo AfterWhile
  275.            Case ">="
  276.              If UCase(cGrid.Text) >= UCase(gstFindExpr) Then GoTo AfterWhile
  277.            Case "<="
  278.              If UCase(cGrid.Text) <= UCase(gstFindExpr) Then GoTo AfterWhile
  279.            Case ">"
  280.              If UCase(cGrid.Text) > UCase(gstFindExpr) Then GoTo AfterWhile
  281.            Case "<"
  282.              If UCase(cGrid.Text) < UCase(gstFindExpr) Then GoTo AfterWhile
  283.            Case "Like"
  284.              If UCase(cGrid.Text) Like UCase(gstFindExpr) Then GoTo AfterWhile
  285.          End Select
  286.        Else
  287.          Select Case gstFindOp
  288.            Case "="
  289.              If cGrid.Text = gstFindExpr Then GoTo AfterWhile
  290.            Case "<>"
  291.              If cGrid.Text <> gstFindExpr Then GoTo AfterWhile
  292.            Case ">="
  293.              If cGrid.Text >= gstFindExpr Then GoTo AfterWhile
  294.            Case "<="
  295.              If cGrid.Text <= gstFindExpr Then GoTo AfterWhile
  296.            Case ">"
  297.              If cGrid.Text > gstFindExpr Then GoTo AfterWhile
  298.            Case "<"
  299.              If cGrid.Text < gstFindExpr Then GoTo AfterWhile
  300.            Case "Like"
  301.              If cGrid.Text Like gstFindExpr Then GoTo AfterWhile
  302.          End Select
  303.        End If
  304.      cGrid.Row = cGrid.Row + 1
  305.      SendKeys "{Down}"
  306.    Wend
  307.    FNotFound = True       'didn't find it
  308.  
  309. AfterWhile:
  310.    ResetMouse Me
  311.  
  312.    'show the first record
  313.    If FNotFound Then
  314.      Beep
  315.      MsgBox "Record Not Found", 48
  316.      GoTo FindStart
  317.    End If
  318.    DoEvents
  319.    cGrid.SelStartRow = cGrid.Row
  320.    cGrid.SelStartCol = 1
  321.    cGrid.SelEndRow = cGrid.Row
  322.    cGrid.SelEndCol = FDS.Fields.Count
  323.  
  324.    GoTo FindEnd
  325.  
  326. FindErr:
  327.    ResetMouse Me
  328.    ShowError
  329.    Resume FindEnd
  330.  
  331. FindEnd:
  332.    MsgBar "", False
  333.  
  334. End Sub
  335.  
  336. Sub FirstButton_Click ()
  337.    Dim numbrows As Long         'number of rows
  338.  
  339.    On Error GoTo GoFirstError
  340.  
  341.    SetHourglass Me
  342.    MsgBar "Going to first record", True
  343.    cGrid.SetFocus
  344.    cGrid.Row = 1
  345.    cGrid.Col = 0
  346.    'get current starting row in grid
  347.    If cGrid.Text <> "1" Then
  348.      FDS.Close
  349. '     Set FDS = gCurrentDB.CreateDynaset(FDS.Name)
  350.      Set FDS = gCurrentDB.CreateSnapshot(FDS.Name)
  351.  
  352.      FNumbRows = GetNumbRecsSS(FDS)
  353.      If FNumbRows > gwMaxGridRows Then
  354.        numbrows = gwMaxGridRows
  355.        FCurrentRow = numbrows
  356.      Else
  357.        numbrows = FNumbRows
  358.      End If
  359.  
  360.      If LoadGrid(cGrid, FDS, FDynSt, numbrows, 0) = False Then
  361.        Unload Me
  362.        Exit Sub
  363.      End If
  364.   End If
  365.   cGrid.Col = 1
  366.   SendKeys "{Home}"
  367.  
  368.   GoTo GoFirstEnd
  369.  
  370. GoFirstError:
  371.   ShowError
  372.   Resume GoFirstEnd
  373.  
  374. GoFirstEnd:
  375.   ResetMouse Me
  376.   MsgBar "", False
  377.  
  378. End Sub
  379.  
  380. Sub Form_Load ()
  381.    Dim t As TableDef       'local table structure
  382.    Dim sp As Integer       'starting point of table name
  383.    Dim ep As Integer       'ending point of table name
  384.    Dim wh As String        'where clause
  385.  
  386.    Dim i As Integer, j As Integer
  387.    Dim fn As String        'field name
  388.    Dim rc As Integer       'record count
  389.    Dim numbrows As Long    'local number of rows
  390.    Dim ss As snapshot
  391.  
  392.    Dim Start1, Finish1, Start2, Finish2
  393.  
  394.    On Error GoTo DynasetErr
  395.  
  396.    SetHourglass Me
  397.    MsgBar "Opening Dynaset", True
  398.  
  399.    'assign the temp string with the select statement
  400.    'if it is not empty, otherwise, use the table list name
  401.    If gfFromSQL = True Then
  402.      If gstDynaString = "" Then
  403.        FDynSt = fSQL.cSQLStatement
  404.      Else
  405.        FDynSt = gstDynaString
  406.      End If
  407.    Else
  408.      FDynSt = fTables.cTableList
  409.    End If
  410.  
  411.    'attemp to open the dynaset
  412.    Start1 = Timer
  413.    If UCase(FDynSt) = "LISTTABLES" Then
  414.      Set FDS = gCurrentDB.ListTables()
  415.    Else
  416.      If gfFromSQL = True And fSQL.cPassThru = 1 Then
  417. '       Set FDS = gCurrentDB.CreateDynaset(FDynSt, VBDA_SQLPASSTHROUGH)
  418.        Set FDS = gCurrentDB.CreateSnapshot(FDynSt, VBDA_SQLPASSTHROUGH)
  419.      Else
  420. '       Set FDS = gCurrentDB.CreateDynaset(FDynSt)
  421.        Set FDS = gCurrentDB.CreateSnapshot(FDynSt)
  422.      End If
  423.    End If
  424.    Finish1 = Timer
  425.  
  426.    Start2 = Timer
  427.    'parse off table name to store in global gstTblName
  428.    wh = ""
  429.    sp = InStr(1, UCase(FDynSt), "FROM")
  430.    If sp > 0 Then
  431.      'must be a "select from" statement
  432.      sp = sp + 5
  433.      For ep = sp To Len(FDynSt)
  434.        'search for a space or the end of FDynSt
  435.        If Mid$(FDynSt, ep, 1) = " " Then
  436.          'get where clause if there is one
  437.          wh = Mid$(FDynSt, sp, Len(FDynSt) - sp + 1)
  438.          Exit For
  439.        End If
  440.      Next
  441.      FTblName = UCase(Mid$(FDynSt, sp, ep - sp))
  442.      If wh = "" Then wh = FTblName
  443.    Else
  444.      'must be a table name only
  445.      FTblName = UCase(FDynSt)
  446.      wh = FTblName
  447.    End If
  448.  
  449.    FDynaString = wh
  450.  
  451.    'show the first record
  452.    FNumbRows = GetNumbRecsSS(FDS)          'query numb of recs
  453.  
  454.    If FNumbRows = -1 Then
  455.      'error occurred but go on anyway
  456.      'because row count is non-critical
  457.      Caption = "SnapShot: " + FTblName
  458.      numbrows = gwMaxGridRows
  459.      FCurrentRow = numbrows
  460.    ElseIf FNumbRows = 0 Then
  461.      Beep
  462.      MsgBox "No Records found!", 48
  463.      Unload Me
  464.      Exit Sub
  465.    ElseIf FNumbRows > gwMaxGridRows Then
  466.      Caption = "SnapShot: " + FTblName + " [" + CStr(FNumbRows) + " total rows]"
  467.      numbrows = gwMaxGridRows
  468.      FCurrentRow = numbrows
  469.    Else
  470.      numbrows = FNumbRows
  471.      Caption = "SnapShot: " + FTblName + " [" + CStr(FNumbRows) + " rows]"
  472.    End If
  473.  
  474.    If LoadGrid(cGrid, FDS, FDynSt, numbrows, 0) = False Then
  475.      Unload Me
  476.      Exit Sub
  477.    End If
  478.  
  479.    Height = 3800
  480.    Width = 5300
  481.    Left = 1000
  482.    Top = 1000
  483.  
  484.    Finish2 = Timer
  485.    If VDMDI.PrefShowPerf.Checked Then
  486.      Me.Show
  487.      MsgBox CStr(FNumbRows) + " rows found in " + CStr(Finish1 - Start1) + " seconds!" + Chr(13) + Chr(10) + CStr(Finish2 - Start2) + " seconds to Load Grid!", 48
  488.    End If
  489.  
  490.    GoTo OkayEnd
  491.  
  492. DynasetErr:
  493.    ShowError
  494.    ResetMouse Me
  495.    MsgBar "", False
  496.    Unload Me
  497.    Exit Sub
  498.    Resume OkayEnd
  499.  
  500. OkayEnd:
  501.    ResetMouse Me
  502.    MsgBar "", False
  503.  
  504. End Sub
  505.  
  506. Sub Form_Resize ()
  507.   On Error Resume Next
  508.  
  509.   'resize grid to window
  510.   If WindowState <> 1 Then   'not minimized
  511.     cGrid.Height = Height - 900
  512.     cGrid.Width = Width - 100
  513.   End If
  514. End Sub
  515.  
  516. Sub Form_Unload (Cancel As Integer)
  517.   On Error Resume Next
  518.  
  519.   'unload the find form
  520.   Unload FFindForm
  521.  
  522.   'close the associated dynaset
  523.   FDS.Close
  524.   MsgBar "", False
  525. End Sub
  526.  
  527. Sub MoreButton_Click ()
  528.   Dim ret As Integer   'return value from loadgrid
  529.  
  530.   On Error Resume Next
  531.  
  532.   MsgBar "Getting more records", True
  533.   If FDS.EOF <> True Then
  534.     SetHourglass Me
  535.  
  536.     ret = LoadGrid(cGrid, FDS, FDynSt, gwMaxGridRows, FCurrentRow)
  537.     If ret = False Then
  538.       'failed so bail out of form
  539.       FDS.Close
  540.       Unload Me
  541.     End If
  542.     'set new current row
  543.     FCurrentRow = FCurrentRow + ret
  544.  
  545.     ResetMouse Me
  546.   End If
  547.   MsgBar "", False
  548.  
  549. End Sub
  550.  
  551. Sub NextButton_Click ()
  552.    Dim c As Integer      'current column
  553.  
  554.    On Error GoTo GoNextError
  555.  
  556.    c = cGrid.Col
  557.    cGrid.Col = 0
  558.    If cGrid.Text = "" Then
  559.      Beep
  560.    ElseIf cGrid.Row = gwMaxGridRows Then
  561.      MoreButton_Click
  562.    Else
  563.      cGrid.SetFocus
  564.      SendKeys "{Down}"
  565.    End If
  566.    cGrid.Col = c
  567.  
  568.    GoTo GoNextEnd
  569.  
  570. GoNextError:
  571.    ShowError
  572.    Resume GoNextEnd
  573.  
  574. GoNextEnd:
  575.  
  576. End Sub
  577.  
  578. 'needed for multi-user situations so
  579. 'new records can be viewed imediately
  580. Sub RefreshButton_Click ()
  581.    Dim numbrows As Long
  582.  
  583.    On Error GoTo RefreshError
  584.  
  585.    MsgBar "Reopening Dynaset", True
  586.    SetHourglass Me
  587. '   Set FDS = gCurrentDB.CreateDynaset(FDS.Name)
  588.    Set FDS = gCurrentDB.CreateSnapshot(FDS.Name)
  589.  
  590.    FNumbRows = GetNumbRecsSS(FDS)
  591.    If FNumbRows = -1 Then
  592.      'error occurred but go on anyway
  593.      'because row count is non-critical
  594.      Caption = "Dynaset: " + FTblName
  595.      numbrows = gwMaxGridRows
  596.      FCurrentRow = numbrows
  597.    ElseIf FNumbRows = 0 Then
  598.      Beep
  599.      MsgBox "No Records found!", 48
  600.      Unload Me
  601.    ElseIf FNumbRows > gwMaxGridRows Then
  602.      Caption = "Dynaset: " + FTblName + " [" + CStr(FNumbRows) + " total rows]"
  603.      numbrows = gwMaxGridRows
  604.      FCurrentRow = numbrows
  605.    Else
  606.      numbrows = FNumbRows
  607.      Caption = "Dynaset: " + FTblName + " [" + CStr(FNumbRows) + " rows]"
  608.    End If
  609.  
  610.    If LoadGrid(cGrid, FDS, FDynSt, numbrows, 0) = False Then
  611.      Unload Me
  612.      Exit Sub
  613.    End If
  614.  
  615.   GoTo RefreshEnd
  616.  
  617. RefreshError:
  618.   ShowError
  619.   Resume RefreshEnd
  620.  
  621. RefreshEnd:
  622.   ResetMouse Me
  623.   MsgBar "", False
  624.  
  625. End Sub
  626.  
  627. Sub SortButton_Click ()
  628.   On Error GoTo SortErr
  629.  
  630. '  Dim ds1 As dynaset, ds2 As dynaset
  631.   Dim ds1 As snapshot, ds2 As snapshot
  632.   Dim SortStr As String
  633.   Dim numbrows As Long    'local number of rows
  634.  
  635.   Set ds1 = FDS            'save the dynaset
  636.   
  637.   SortStr = InputBox("Enter Sort Column:")
  638.   If SortStr = "" Then Exit Sub
  639.  
  640.   FDS.Sort = SortStr
  641. '  Set ds2 = FDS.CreateDynaset()            'establish the Sort
  642.   Set ds2 = FDS.CreateSnapshot()            'establish the Sort
  643.   Set FDS = ds2            'assign back to original dynaset object
  644.  
  645.   'everything must be okay so redisplay form on 1st record
  646.   FNumbRows = GetNumbRecsSS(FDS)          'query numb of recs
  647.    If FNumbRows = -1 Then
  648.      'error occurred but go on anyway
  649.      'because row count is non-critical
  650.      Caption = "Dynaset: " + FTblName
  651.      numbrows = gwMaxGridRows
  652.      FCurrentRow = numbrows
  653.    ElseIf FNumbRows = 0 Then
  654.      Beep
  655.      MsgBox "No Records found!", 48
  656.      Unload Me
  657.      Exit Sub
  658.    ElseIf FNumbRows > gwMaxGridRows Then
  659.      Caption = "Dynaset: " + FTblName + " [" + CStr(FNumbRows) + " total rows]"
  660.      numbrows = gwMaxGridRows
  661.      FCurrentRow = numbrows
  662.    Else
  663.      numbrows = FNumbRows
  664.      Caption = "Dynaset: " + FTblName + " [" + CStr(FNumbRows) + " rows]"
  665.    End If
  666.   If LoadGrid(cGrid, FDS, FDynSt, numbrows, 0) = False Then
  667.     Unload Me
  668.     Exit Sub
  669.   End If
  670.   GoTo SortEnd
  671.  
  672. SortErr:
  673.   ShowError
  674.   Set FDS = ds1            're-assign back to original
  675.   Resume SortEnd
  676.  
  677. SortEnd:
  678.  
  679. End Sub
  680.  
  681.