Continue=False does not work

Good morning, I have a problem with LotusScript below, I put it on the querysave event of the form, the first thing is checking the ResourceName, if it is blank, should not be Continue,but it does not, how to change the coding to fix this problem?

Thanks in advance.

Linda

…

Dim doc1 As NotesDocument

Set doc1= Source.document

If Source.Document.ResourceName(0)="" Then

	Messagebox " Please click available button and choose a resource."

Call source.GotoField( “ResourceName” )

Continue = False

End If



If Source.IsNewDoc Then  

	Set item = source.document.GetFirstItem( "repeat" )

	Forall v In item.Values

		Set view=db.getview("LookUp")

		'akey=source.Document.ResourceName(0)+Str(source.Document.calendarDate(0))

		akey=source.Document.ResourceName(0)+v

		Set doc=view.GetDocumentByKey(akey)

		If Not doc Is Nothing Then

			

			Messagebox "The date  " + v+ "  was booked"

			Continue=False

			Exit Sub

		Else

			

			Set ndoc=db.CreateDocument

			ndoc.form="Reservation"

			ndoc.ReservedBy=doc1.ReservedBy(0)

			ndoc.sDate=doc1.sDate(0)

			ndoc.eDate=doc1.eDate(0)

			ndoc.calendarDate=Cdat(v)

			ndoc.repeat=doc1.repeat

			ndoc.ResourceName=doc1.ResourceName(0)

			ndoc.Description=doc1.Description(0)

			

			Call ndoc.MakeResponse( doc1 )

			Call ndoc.Save( False, True )

		End If

	End Forall 

End If

Subject: Continue=False does not work.

Linda,

I would try a couple things:

  1. Exit Sub after your Continue = False line so that your script stops executing. Continue = False merely prevents the save from occurring, it doesn’t stop the execution of the rest of the qs code

  2. you’ve already set doc1 = source.document, so just refer to doc1.ResourceName ( 0 )

regards,

raphael

Subject: RE: Continue=False does not work.

Thanks both of you very much! Matt, Raphael.

It works fine now! :slight_smile:

Linda

Subject: Continue=False does not work.

You need an Exit Sub after you set Continue to False

If Source.Document.ResourceName(0)=“” Then

Messagebox " Please click available button and choose a resource."

Call source.GotoField( “ResourceName” )

Continue = False

Exit Sub

End If