Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '---------------------------------------------------------------------------------------
- ' Procedure : SaveSearches
- ' Author : zman
- ' Date : 11/4/2009
- ' Purpose : Saves all search information to current text report database
- '---------------------------------------------------------------------------------------
- '
- Private Function SaveSearches() As Boolean
- Dim rs As DAO.Recordset
- Dim i As Long
- Dim hg As New CHourglass
- On Error GoTo catch
- 'Debug.Assert False
- ' check if all items have been removed, if so, no need to delete a bunch of record, we can just delete everything
- If (grdTerms.Rows = 1) Then
- SearchReport.DeleteOnClose = True
- GoSub success
- End If
- ' database
- hg.ShowBusy Me, , "Saving Search Settings..."
- ' mark any existing searches as inactive
- If (DeletedItems.count) Then
- SearchReport.ClearDeletedItems DeletedItems
- Set DeletedItems = Nothing
- End If
- ' update existing requests
- SearchReport.OpenSearchTable
- For i = 1 To (grdTerms.Rows - 1)
- If (SearchID(i) = 0) Then
- ' new search, add to database
- grdTerms.TextMatrix(i, COL_ID) = SearchReport.AddSearch(SearchText(i), ItemSelected(i))
- ElseIf SearchModified(i) Then
- ' existing search was modified
- SearchReport.UpdateSearch SearchID(i), ItemSelected(i), SearchDocs(i), SearchHits(i), LastDtsearchID(i)
- End If
- Next
- success:
- ' return success
- SaveSearches = True
- ListModified = False
- Finally:
- On Error Resume Next
- SearchReport.CloseSearchTable
- Exit Function
- catch:
- LastError.Cache
- Resume Finally
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement