Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. '---------------------------------------------------------------------------------------
  2. ' Procedure : SaveSearches
  3. ' Author    : zman
  4. ' Date      : 11/4/2009
  5. ' Purpose   : Saves all search information to current text report database
  6. '---------------------------------------------------------------------------------------
  7. '
  8. Private Function SaveSearches() As Boolean
  9.  
  10.    Dim rs As DAO.Recordset
  11.    Dim i As Long
  12.    Dim hg As New CHourglass
  13.    
  14.    On Error GoTo catch
  15.    
  16.    'Debug.Assert False
  17.  
  18.    ' check if all items have been removed, if so, no need to delete a bunch of record, we can just delete everything
  19.   If (grdTerms.Rows = 1) Then
  20.       SearchReport.DeleteOnClose = True
  21.       GoSub success
  22.    End If
  23.      
  24.    ' database
  25.   hg.ShowBusy Me, , "Saving Search Settings..."
  26.    
  27.    ' mark any existing searches as inactive
  28.   If (DeletedItems.count) Then
  29.       SearchReport.ClearDeletedItems DeletedItems
  30.       Set DeletedItems = Nothing
  31.    End If
  32.    
  33.    ' update existing requests
  34.   SearchReport.OpenSearchTable
  35.    For i = 1 To (grdTerms.Rows - 1)
  36.       If (SearchID(i) = 0) Then
  37.          ' new search, add to database
  38.         grdTerms.TextMatrix(i, COL_ID) = SearchReport.AddSearch(SearchText(i), ItemSelected(i))
  39.      
  40.       ElseIf SearchModified(i) Then
  41.          ' existing search was modified
  42.         SearchReport.UpdateSearch SearchID(i), ItemSelected(i), SearchDocs(i), SearchHits(i), LastDtsearchID(i)
  43.       End If
  44.    Next
  45.    
  46. success:
  47.    ' return success
  48.   SaveSearches = True
  49.    ListModified = False
  50.    
  51. Finally:
  52.    On Error Resume Next
  53.    SearchReport.CloseSearchTable
  54.    Exit Function
  55. catch:
  56.    LastError.Cache
  57.    Resume Finally
  58. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement