NotesUIView.SelectDocument problem

I have been experiencing intermitant problems with NotesUIView.SelectDocument. The context of the problem is the following. There is code in the postopen a database which searches for a document owned by the user who opens the database and positions itself on the document in the uiView which is opened. The code works fine but seems to stop working for an unknown reason after having worked for a given period of time. I’ve tried deleting the cache.ndk of the user and optimizing the workspace but the problem persists. One strange fact is that if I remove database’s icon from the workspace and reopen the database, the problem doesn’t occure, but when the database is closed and opened again, the problem returns. When the database is opened, the view is positioned at the complete bottom but if I press on arrow up or down on the keyboard, I see that the doc was indeed selected, but the view was not positioned to display it. I’ve tried adding a uiview.refresh before and/or after the selectdocument, but this didn’t help. Here’s the portion of code that has the problem:

Dim ws As New NotesUIWorkspace

Dim db As NotesDatabase

Dim vue As NotesView

Dim doc As NotesDocument

Dim uiView As NotesUIView

Set db = session.CurrentDatabase

Set vue = db.GetView(“TOUS_NOM”)

Set doc = vue.GetDocumentByKey(session.CommonUserName, True)

If Not doc Is Nothing Then

Set uiView = ws.CurrentView

 

If Not uiview Is Nothing Then

    Call uiView.SelectDocument(doc)

End If		

End If

Any help would be appreciated!

Subject: NotesUIView.SelectDocument problem

try the GotoEntry method of NotesViewNavigator. I haven’t tested it but it should work for you.

Subject: RE: NotesUIView.SelectDocument problem

I don’t think the NotesViewNavigator will have an influence on the front-end of Notes because that object is part of the back-end. Unless there’s a method that I’m not aware of that could allow this?

Subject: RE: NotesUIView.SelectDocument problem

you may be correct although I have not done any testing. Is the code you posted the only code that appears in the db’s postopen event? If so why not use this instead:

@Command( [OpenView] ; viewName ; key ; newinstance )

Parameters

viewName

Text. Optional. The name of the view you want to open. If you omit the view name, the database opens to its default view; or, if the user has opened the database before, to the last view used by that person. If the database is already open to the specified view, Notes/Domino makes that the topmost window.

key

Text. Optional. Indicates which document you want Notes/Domino to scroll to when it opens viewName. The key is a value that appears in the first sorted column of viewName. If you omit the key, no document is selected.

Subject: RE: NotesUIView.SelectDocument problem

Thanks for the suggestion, I’ll give that a try, seems to be a good alternative. Thanks again!