How do I set view to current view in this lotus script?

I have this code:
Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As
Variant, Continue As Variant)
      Dim session As New notessession
      Set db = session.currentdatabase
      Set view = db.getview("People")

      Set ProfileDoc = db.getprofiledocument("PickerView")
'     ProfileDoc.Pview = "People"
End Sub
And I want it to work no matter what the current view is.. so not just "People" can I have it work with "current view" ?
Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As 
Variant, Continue As Variant) 
      Dim session As New notessession 
      Set db = session.currentdatabase 
      Set view = db.getview("People") 
 
      Set ProfileDoc = db.getprofiledocument("PickerView") 
'     ProfileDoc.Pview = "People" 
End Sub

Open in new window

MontereyAsked:
Who is Participating?
 
Sjef BosmanConnect With a Mentor Groupware ConsultantCommented:
That's what I implied with my last paragraph. The current view may be hidden beneath a document, but AFAIK it's still the current view, the topmost view. If a document is open in the UI, that document may not even be from the current view, if the user switched panes using one or more Ctrl-Tabs. I'll check tomorrow whether there's a current view if a document is open in the UI.

By the way, according to the Help database, it says on the ParentView property:
"If the document was retrieved directly from a database or a document collection, the ParentView property returns Nothing."
0
 
Sjef BosmanGroupware ConsultantCommented:
The current view? I don't quite understand what you're looking for. Why do you need the current view? But I suppose that you need the following:

Dim ws As New NotesUIWorkspace
Dim uiview As NotesUIView
Dim view As NotesView

Set uiview= ws.CurrentView
Set view= uiview.View

One warning though: I noticed that playing too much with the CurrentView can lead to a crash of the Notes client. Sometimes, there is no current view, for example if you are on the Notes Workspace, no database open, and you type Ctrl-M. Similarly, you can click a database icon once, then click Create and then select one of the forms in the database. Or the database is set to open a form when opened, e.g. an enquiry form.
0
 
tilerCommented:
When you're in a document, there's no "current view" in the sense sjef is thinking. If you want to know what view the document was opened from, you could use the expression Source.Document.ParentView.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.