Subject: RE: need help with the search code…section (code posted)
Raphael,
Am I doing something wrong here? The collection always shows 0.
There is only one bulkdensity field on my form by the way.
Sub Click(Source As Button)
Dim beginning As String
Dim ending As String
'User enters beginning MOR…
askbeginningagain:
beginning = Inputbox$("Enter beginning MOR", "Search")
If beginning = "" Then
Msgbox "Lab Search Canceled.", MB_OK, "Search"
Exit Sub
num% = Cint(beginning)
End If
If Not Isnumeric(beginning) Then
Msgbox "Only numbers are allowed, try again please.", MB_OK, "Search"
Goto askbeginningagain
End If
'User enters ending MOR…
askendingagain:
ending = Inputbox$("Enter ending MOR", "Search")
If ending = "" Then
Msgbox "Lab Search Canceled.", MB_OK, "Search"
Exit Sub
num% = Cint(ending)
End If
If Not Isnumeric(ending) Then
Msgbox "Only numbers are allowed, try again please.", MB_OK, "Search"
Goto askendingagain
End If
'Now collect the documents based on beginning and ending MOR and display for the user…
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim session As New notessession
Dim db As NotesDatabase
Set db = session.currentdatabase
Dim collection As NotesDocumentCollection
Dim doc As NotesDocument, doc2 As NotesDocument
Dim rtitem As NotesRichTextItem
Dim dateTime As New NotesDateTime ( "1/1/2007" )
Set collection = db.search ( {Form = "LR" & bulkdensity > @TextToNumber("} & beginning & {") & bulkdensity < @TextToNUmber("} & ending & {")}, dateTime, 0 )
'Set collection = db.FTSearch(SearchString$, 0)
Msgbox "There are " & collection.count & " documents with MOR greater than " & beginning &" and less than " & ending &".", MB_OK, "Search"
If collection.count = 0 Then
Exit Sub
End If
If collection.Count > 0 Then
Set doc2 = db.CreateDocument
doc2.form = "Report"
Set rtitem = New NotesRichTextItem(doc2, "Link")
'.......populate doc2 fields.....
'..........................................
'..........................................
'..........................................
'..........................................
'..........................................
Set doc = collection.GetFirstDocument
Do Until doc Is Nothing
' End If
' Next
Set doc = collection.GetNextDocument(doc)
Loop
Call rtitem.Update
Set uidoc = ws.EditDocument(False, doc2)
End If
End Sub