In R6, I’m having a problem using the CurrentDocument Property of the NotesUIWorkspace in a PostOpen Event when the document is opened in the Preview Pane.
My code is as follows
Set UIDoc= Workspace.CurrentDocument
Set ParentDoc = UIDoc.document
The Object Variable Not Set error is thrown when attempting to Set ParentDoc because UIDoc has not been set.
The database was built in R5 and functions fine in R5.
Has anyone else experienced this? Is there a solution or workaround?
I’m having the exact same problem. Have code that has been working fine in R4 & R5 but errors out in R6. This is really basic functionality too, just uiworkspace and uidoc handles. I’ve run the same function code on two machines at the same time and only the R6 machine errors out!
Subject: Object Variable Not Set when access CurrentDocument in Preview Pane
Having exactly the same problem :
Set uidoc = workspace.CurrentDocument
If uidoc.Isnewdoc = False Then
Also the Initialize part of the computed field that this code was in also disappeared. I had to change the field to be an editable text field. When changes like this happen, does no one think to let us developers know?
Subject: RE: Object Variable Not Set when access CurrentDocument in Preview Pane
I didn’t know, myself. It’s quite possible that the developer who made the change didn’t realize that it would have this effect, but was just doing something to fix another thing that was broken. So maybe nobody knew, to be able to tell you.
This is the sort of thing I like to keep track of, and occasionally I’ll give a presentation at Lotusphere or the like that includes tips for updating apps.
Subject: RE: Object Variable Not Set when access CurrentDocument in Preview Pane
I hav raised it as a problem under our passport agreement helpline. I will post any further updates as and when I get them. If there is anyone else out there with a fix (or a decent work around) then please let me know. We are about to start rolling out a full update, but it will now be on hold until we resolve this MAJOR issue. This effects 80% of our databases.
Subject: RE: Object Variable Not Set when access CurrentDocument in Preview Pane
I must have misunderstood exactly what your problem was, because here you are asking for a workaround, and I thought I posted a workaround in my first response.
Response from Lotus. I have had to move the code into the PostOpen event now, and taken it out of the Initalize part of the field. Here’s what they said:
"As to your last query regarding whether this issue would be raised in the
future as needing to be patched. What I can tell you is that Notes is
working as designed. In some cases, LotusScript users sometimes presume it
to be similar to Visual Basic with regards to its handling of forms and
events, but this in fact is not true - these are quite different. So, in a
nutshell, this is the way Notes is designed to handle events and so there
will be no foreseeable change to this. I hope this has helped somewhat."
A little miffed as this worked under R5 so it still should under Notes6. Any thoughts?
Subject: Object Variable Not Set when access CurrentDocument in Preview Pane
I don’t know about any change to this functionality, but I do know that the Postopen event receives the current NotesUIDocument as an argument called Source. Use that instead of CurrentDocument.
Subject: RE: Object Variable Not Set when access CurrentDocument in Preview Pane
Andre, I have a similar problem where I use the isnewdoc to decide wether to refresh the view or not. On one client as the debug goes over the line set “uidoc=workspace.currentdocument”, it picks up nothing and there fore the next line “if uidoc.Is new Doc = False then…” fails and I get an error. How would I implement the Source into this code?Strangely enough the code works fine on most of the clients… all R6!