Link to home
Start Free TrialLog in
Avatar of Monterey
Monterey

asked on

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

Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

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.
Avatar of tiler
tiler

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.
ASKER CERTIFIED SOLUTION
Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial