Hi
Can someone save my day or at least guide me in the correct direction please?
I have a view named (DO) which contains an asorted column with lots of dates in it.
Basically, from my created action button on my named (TR) folder, I am requesting the user to input 2 different dates from 2 input boxes.
I then want to gather these documents between the two dates & put them in the folder (TR).
My problem is getting the between dates into 1 collection.
So far my code looks like :
Dim ws As New notesuiworkspace
Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
Dim doc As NotesDocument
Dim view As NotesView
Dim dc As NotesDocumentCollection
Dim vc As NotesViewEntryCollection
'Remove all previous docs from the view before searching.
Set view = db.GetView(“TR”)
Set vc = view.AllEntries
If vc.count > 0 Then
response = Messagebox(“Starting a new search will remove the results from the previous search.”+Chr(10)+_
"Do you wish to continue?",36,"Outstanding Replies Search")
If response = 6 Then 'Yes
Print “General - Removing previous search results…”
Call vc.RemoveAllFromFolder( “TR” )
End If
If response = 7 Then 'No
Continue = False
End If
End If
Set view = db.GetView("DO")
'Get the first input date
response = Inputbox (“Please enter the first date of your search. Please enter the format of DD/MM/YYYY”, “Search Targets”)
'Ensure inputted date is correct format
response2 = Cdat(Format(response,“dd/mm/yyyy”))
If response2 = “” Then
Exit Sub
End If
'Get the second input date
endresponse = Inputbox (“Please enter the second date of your search. Please enter the format of DD/MM/YYYY”, “Search Targets”)
'Ensure inputted date is correct format
endresponse2 = Cdat(Format(endresponse,“dd/mm/yyyy”))
If endresponse2 = “” Then
Exit Sub
End If
‘’'This is where I am having trouble !!!
query$ = ""
If endresponse2 > response2 Then
If query$ = “” Then
query$ = addtoquery$
Else
query$ = query$ + " ACCRUE "+ addtoquery$
End If
End If
'Get All documents with those dates
& put in folder TR
Set vc = view.AllEntries
Call vc.FTSearch(query$,0)
Set dc = view.GetAllDocumentsByKey(query$, False)
If dc.count = 0 Then
Messagebox "The system has found no cases of outstanding replies dating "+response, 64, "Search"
Exit Sub
End If
'Cycle through documents, copying to archive database and then removing from live database
Set doc = dc.getfirstdocument
'variables to track progress in print bar
total = dc.count
current = 1
archived = 0
While Not (doc Is Nothing)
Set doc1 = dc.getnextdocument(doc)
percentcomplete = current*100/total
Call dc.PutAllInFolder( “TR” )
'Remove from live database
'Call doc.Remove(True)
archived = archived + 1
' End If
Set doc = doc1
current = current + 1
Wend
Print "Searching complete - please wait while the view is refreshed ... (this can take upto 30 minutes)"
'Refresh view at end (This can take a while if a large number of documents have been moved)
Call ws.viewrefresh
Print "Searching complete - thank you for waiting"
If archived > 0 Then
Messagebox "The system found "+Cstr(total)+" cases that had outstanding replies of "+DateOpened+"."+_
Chr(10)+" .",64,"Search Replies"
End If
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
’ Wend
End Sub