Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

'Attempt to execute nested form events' error

Posted on 1999-07-16
10
Medium Priority
?
3,193 Views
Last Modified: 2013-12-18
I have a problem where the above error messages occurs. I know why its occuring, but I cannot figure a way to stop it happening.
I am developing a database where documents go through an approval cycle. Once approved and the document is then changed I want to keep a copy of the old document and start the approval cycle again on the newly saved copy.

The document has versioning set to 'Prior versions become responses' and create versions is set to manual.

In the QuerySave event I check to see if the document is approved and if so then do a 'Call source.SaveNewVersion'
so that the old version is kept as a response.
         
When the document is saved everything happens as expected with the exception of the annoying error message.

Lotus Support's answer to this error message is to move the call save to the QueryClose event, but this won't work as I need a copy before any changes have been made.

Hope someone can help.
0
Comment
Question by:Jeff12345
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 2
10 Comments
 
LVL 3

Expert Comment

by:MW
ID: 1119865
You can't call uidoc.save (source.save) within QuerySave as this would call the QuerySave event again. Notes is preventing you from creating endless event loops and does warn you with this error message.

If you post the code I might be able to give you a workaround
0
 

Author Comment

by:Jeff12345
ID: 1119866
MW,

I know that you can't do a normal save within a QuerySave event, but what I am attempting to do is create a new version (as a response) of the document using the call.SaveNewVersion command. This is the code in the QuerySave event which checks the status on the form to see if a new version is required or not

          If(source.fieldgettext("status")="5")  Then
               Messagebox "A copy of the old Position Summary has been created."
               Call source.SaveNewVersion          
          End If
         
If I change the form properties to auto-create new version then a copy of the document is saved every time it moves through the approval cycle, but I only wan't it to happen when its 'approved' (status=5)

Hope this gives you a little more info

Jeff
0
 

Author Comment

by:Jeff12345
ID: 1119867
MW,

I know that you can't do a normal save within a QuerySave event, but what I am attempting to do is create a new version (as a response) of the document using the call.SaveNewVersion command. This is the code in the QuerySave event which checks the status on the form to see if a new version is required or not

          If(source.fieldgettext("status")="5")  Then
               Messagebox "A copy of the old Position Summary has been created."
               Call source.SaveNewVersion          
          End If
         
If I change the form properties to auto-create new version then a copy of the document is saved every time it moves through the approval cycle, but I only wan't it to happen when its 'approved' (status=5)

Hope this gives you a little more info

Jeff
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 3

Accepted Solution

by:
MW earned 800 total points
ID: 1119868
I know what you're trying to do. Nevertheless, you can't do it! SaveNewVersion is calling the QuerySave event too. The error message proves that I'm right.

I'm thinking about a solution. Give me a couple of minutes before you reject my answer again. Wait for my comments.


0
 
LVL 2

Expert Comment

by:Paebdb
ID: 1119869
Two ideas:
- Is it possible to call your code in the exiting event of the Status field, when the status changed to 5?

- Otherwise you could create a new document, fill it with the values, remember its UNID and it the QuerySave make it a respond doc to the saved parent (MakeResponse method).
0
 
LVL 2

Expert Comment

by:Paebdb
ID: 1119870
Sorry, use MakeResponse in the Postsave.
0
 
LVL 3

Expert Comment

by:MW
ID: 1119871
OK, here we are. Basically Paebdb's second comment goes in the right direction: your code should look like this

dim session as new notessession
dim db as notesdatabase
dim newdoc as notesdocument

set db = session.currentdatabase
set doc = db.createdocument

call source.refresh()
call source.document.copyallitems(newdoc)
call newdoc.makeresponse(source.document)
call newdoc.save(true,false,false)

continue = false

call source.reload()
call source.close()

Make sure that you call the part of the code only if

source.isnewdoc = false        !!!!!

0
 
LVL 3

Expert Comment

by:MW
ID: 1119872
I forgot:

The most simple way is to use the form property "versioning = New version becomes response"
0
 

Author Comment

by:Jeff12345
ID: 1119873
MW:

Thanks a lot!  That code worked a treat
0
 

Author Comment

by:Jeff12345
ID: 1119874
MW:

Thanks a lot!  That code worked a treat
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question