April 27, 2004
Help is just an IM and a forum away...
Posted by Jess in
Tech Talk
So here I was. Tired from being up until the wee hours of the morning working on the error message. Matt had been up until the wee hours of the morning with me, working on the error message. And he's not even a Lotus guy! He's just good like that.
I was really, really sick and tired of the error message.
My blood pressure was really, really rising because of the error message.
My deadline had come and gone, but there was that error message.
What was it? "Attempt to execute nested events" when I clicked a button. Now I know that this is usually caused by calling doc.Save in the QuerySave event, or something similar, such as calling uidoc.Refresh in PostRecalc. I had none of these (or so I thought).
Here was my button code:
Dim ws As New NotesUIWorkspace
Set uidoc = ws.currentdocument
uidoc.EditMode = True
Call uidoc.FieldSetText("SetFlag", "1")
Call uidoc.Refresh
uidoc.EditMode = False
The error occurred between the following lines:
uidoc.EditMode = True
Call uidoc.FieldSetText("SetFlag", "1")
I also had the following PostRecalc code:
If source.Document.SetFlag(0) = "1" Then
Call RunMe
End If
I figured it was a timing issue as the error went away if I ran it through the debugger. It also went away if I put a 'msgbox "Hi!"' in between also.
I tried everything. I tried putting a sleep command, a Yield, etc. I converted it to use the backend doc instead of uidoc. I saved the doc and had the code run in the QuerySave. No luck.
(the reason for the code being done this way is to run the function RunMe, which was out of scope for the button and there was no way to use an agent. I'm just waiting for someone to ask!)
I got up early after going to bed late working on it. It's very lonely when your code won't work and no one's online in IM. :-) Finally, around 9:30 AM I threw in the white towel and posted on the forum.
All of a sudden, the help rang out. Joe answered my post with a great suggestion (which wasn't the solution, but thanks anyway!). Bruce, being the first online, got the panicky chat alert first. Bruce then kindly put out an All-Points Bulletin for me, and more help started rolling in. Rob McDonagh came up with another fantastic suggestion (that I was in the middle of trying once a fix came in on the forum by John Lanham). In the meantime, Chris Toohey was jumping on the help bandwagon, and even recruited one of his coworkers to drop me a line about it.
What was the problem? It wasn't an entire timing issue, as I thought. It was the Form property "Automatically refresh fields" being checked. So I really *was* attempting to execute nested form field events! Who knew? Apparently John did. I was calling a refresh within a refresh. Or at least a split second before a refresh. Which, apparently, is close enough.
This post has two purposes, the first one is to show the world the painful Gotcha that I was just exposed to (so they don't spend as long on it as I did!), and secondly, to once again point out that Dominoids are the coolest people on earth. :-D
Permalink
|
TrackBack (0)
Comments