Problems opening folders that I automatically created via Lotus Script...
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.OpenView(ReportTitle) 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") Call db.UpdateFTIndex(True) 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 Print count Wend Call vw.Clear Messagebox "Report is complete" Call ws.CurrentDatabase.OpenView(ReportTitle)End Sub
I tried adding the following code (listed below) to close the form and reopen the database to the newly created folder. It actually worked initally when I tried it on my computer. It didn't work exactly how I wanted it to since it keeps the initial window open in the background and opens another instance on top but hey, I can't complain about that.
The strange thing about this work around is that I can't get it to work on every pc/user that's been testing this for me. Some people still get the same error as before while others don't. I thought this might be a caching issue but I watched as the debugger runs through the new code and it is present. (sigh) gotta love Notes.
Open in new window