Hi Everyone,
I have problems with my code below.
This is what I’m wanting to do:
If any of the Defect Yes/No boxes are Yes, and the Description field next to it is blank, then they are reminded that they have to fill in a description or set
the Defect Yes/No field to No.
It doesn’t appear to be working correctly. I wanted to group them all together, as I don’t want the user to have
8 reminders, if they forget to enter a description or put them to No. I just want one reminder to go out
regardless of the amount. I also need the document to stop saving, so they can go back into the document and
modify it accordingly.
QuerySave:
Dim session As New NotesSession
Dim workspace As NotesUIWorkspace
Set workspace=New NotesUIWorkspace
Dim db As NotesDatabase
Set db=session.CurrentDatabase
Dim uidoc As NotesUIDocument
Set uidoc=workspace.currentdocument
Dim doc As NotesDocument
Set doc=uidoc.document
Dim value As String
Dim value1 As String
DYN = doc.DefectYesNo(0)
DYN1 = doc.DefectYesNo_1(0)
DYN2 = doc.DefectYesNo_2(0)
DYN3 = doc.DefectYesNo_3(0)
DYN4 = doc.DefectYesNo_4(0)
DYN5 = doc.DefectYesNo_5(0)
DYN6 = doc.DefectYesNo_6(0)
DYN7 = doc.DefectYesNo_7(0)
VCRD = doc.VCRDescription(0)
VCRD1 = doc.VCRDescription_1(0)
VCRD2 = doc.VCRDescription_2(0)
VCRD3 = doc.VCRDescription_3(0)
VCRD4 = doc.VCRDescription_4(0)
VCRD5 = doc.VCRDescription_5(0)
VCRD6 = doc.VCRDescription_6(0)
VCRD7 = doc.VCRDescription_7(0)
Source.Refresh
Source.Reload
'### Start Error Checking ###
If ((DYN = "Yes") Or (DYN1="Yes") Or (DYN2="Yes") Or (DYN3="Yes") Or (DYN4="Yes") Or (DYN5="Yes") Or (DYN6="Yes") Or (DYN7="Yes")) Then
value = "Yes"
End If
If ((VCRD = Null) Or (VCRD1=Null) Or (VCRD2=Null) Or (VCRD3=Null) Or (VCRD4=Null) Or (VCRD5=Null) Or (VCRD6=Null) Or (VCRD7=Null)) Then
value1 = "Yes"
End If
If ((value = "Yes") And (value1="Yes")) Then
Msgbox("If any item has the Defect set to Yes, please enter a description, otherwise set Defect Yes/No to No, you cannot save this document otherwise.")
source.GotoField( "VCRDescription" )
continue = False
End If
'### End Error Checking ###
I’m getting this error:
Attempt to execute nested form events
Any help, most appreciated.
Thanks,
Hayley
Subject: Help needed with LotusScript. - Attempt to execute nested form events
Hi,
Thanks for your response, I don’t have anything in Queryrecalc. I do have this in PostSave though.
Any other ideas?
Thanks again,
Hayley.
@Command([EditDocument];“1”);
@Command([ViewRefreshFields]);
@If(@Prompt([YesNo];“Vehicle Check Confirmation”;“Are you sure you want to save this document?”);@Command([FileSave]) & @Command([FileCloseWindow]);@Return(@Command([FileCloseWindow])));
@If(ConfirmService!=“Yes”;@MailSend(Facilities;“”;“”;“Crawley Business Drivers DB Notification - Vehicle Check Report “;””;“Monthly Check has been completed and sent for your information.”+@NewLine +“The driver has not confirmed that this vehicle has been serviced in line with the manufacturers’ handbook.”+@NewLine+@NewLine + "Please follow link - " +@NewLine +@NewLine + “Thank you.”;[IncludeDoclink])|@PostedCommand([FileSave])|@PostedCommand([FileCloseWindow]);
@MailSend(Name;“”;“”;“Crawley Business Drivers DB Notification - Vehicle Check Report “;””;“Monthly Check has been completed and sent for your information”+@NewLine +@NewLine + "Please follow link - " +@NewLine +@NewLine + “Thank you.”;[IncludeDoclink])|@PostedCommand([FileSave])|@PostedCommand([FileCloseWindow]))
Subject: RE: Help needed with LotusScript. - Attempt to execute nested form events
Yes your @Command([FileSave]) is causing the problem. This will fire QuerySave event and that in turn fire your PostSave.And there is no a logical end for this call process.
When a form event fires another event and that in turn calls your previous event this error will arise, since there won’t be any end condition.
Subject: Help needed with LotusScript. - Attempt to execute nested form events
You also don’t need to go through all that rigamarole to obtain the notesuidocument. The QuerySave event hands you the document as an argument.
Subject: Help needed with LotusScript. - Attempt to execute nested form events
Check whether you are saving uidoc in QueryRecalc event. That may cause error as your Source.Refresh will fire QuerySave and again QuerySave will fire Queryrecalc… and there won’t be an end for this process
Subject: RE: Help needed with LotusScript. - Attempt to execute nested form events
Hi,
Thanks for your response, I don’t have anything in Queryrecalc. I do have this in PostSave though.
Any other ideas?
Thanks again,
Hayley.
@Command([EditDocument];“1”);
@Command([ViewRefreshFields]);
@If(@Prompt([YesNo];“Vehicle Check Confirmation”;“Are you sure you want to save this document?”);@Command([FileSave]) & @Command([FileCloseWindow]);@Return(@Command([FileCloseWindow])));
@If(ConfirmService!=“Yes”;@MailSend(Facilities;“”;“”;“Crawley Business Drivers DB Notification - Vehicle Check Report “;””;“Monthly Check has been completed and sent for your information.”+@NewLine +“The driver has not confirmed that this vehicle has been serviced in line with the manufacturers’ handbook.”+@NewLine+@NewLine + "Please follow link - " +@NewLine +@NewLine + “Thank you.”;[IncludeDoclink])|@PostedCommand([FileSave])|@PostedCommand([FileCloseWindow]);
@MailSend(Name;“”;“”;“Crawley Business Drivers DB Notification - Vehicle Check Report “;””;“Monthly Check has been completed and sent for your information”+@NewLine +@NewLine + "Please follow link - " +@NewLine +@NewLine + “Thank you.”;[IncludeDoclink])|@PostedCommand([FileSave])|@PostedCommand([FileCloseWindow]))