I need to be able to give users the flexibility to create their own reports in a Lotus Notes database. Maybe there's an easier way and I might be taking the wrong approach to the design of this database, but I essentially created a form that will manipulate the Notes full text search functions.
Right now the form only has three fields: a text field for the Report Title and two date fields (Start and End).
After the user clicks the 'create report' button, the code I specified below executes.
The program gathers all documents that fall within the date range the user specifies and then dumps them in a folder that is created with the title of whatever the user typed into the 'Report Title' field.
Now the problem I'm having is actually opening up that new folder that was just created. I put the line: Call ws.CurrentDatabase.OpenVie
tle) at the end of the code but I get the error message: "View or Navigator '[folder name]' does not exist. The folder does however exist. If I close out and come back in I see that it was created by the code.
Is there some other way I should be doing this? or is my concept of creating a 'reporting form' just poor design all together?
All suggestion appreciated. Thanks,
Sub Click(Source As Button)
Dim ws As New NotesUIWorkspace
Dim s As New NotesSession
Dim db As NotesDatabase
Dim vw As NotesView
Dim doc As NotesDocument
Dim uidoc As NotesUIDocument
Dim j As Long
Dim count As Integer
Set db = s.CurrentDatabase
Set vw = db.GetView("Main")
Set uidoc = ws.CurrentDocument
ReportTitle = uidoc.FieldGetText("rptTitle")
strSearch = "[dataEndTS] >= " & uidoc.FieldGetText("rptStartDate") & " And [dataEndTS] <= " & uidoc.FieldGetText("rptEndDate")
j = vw.FTSearch(strSearch, 0)
count = 0
Set doc = vw.GetFirstDocument
While Not(doc Is Nothing)
Call doc.PutInFolder(ReportTitle, True )
Set doc = vw.GetNextDocument(doc)
count = count + 1
Messagebox "Report is complete"