Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 216
  • Last Modified:

Closing form without saving

I need to get the script that will close a form if there is a duplicate entry for a field. The code now is either not working or is prompting the user if they want to save. If a form has already been entered it should alert that them that this office has already completed the form and close the window without saving. Here is the current code.

Sub Exiting(Source As Field)
     Dim workspace As New NotesUIWorkspace    
     Dim session As New NotesSession    
     Dim agynum As String
     Set uidoc = workspace.CurrentDocument
     Set db = session.CurrentDatabase
     Set ndoc = uidoc.Document  
     Set view = db.GetView("(completed)")
'     Call uidoc.Save
     
     agynum = uidoc.FieldGetText( "office_number")
     key = agynum
     Set ndoc = view.GetDocumentbyKey(key)
     If ndoc Is Nothing Then
          Exit Sub
     Else
          Msgbox "Thank you, but a survey has already been completed for your agency. "
          Call uidoc.close
          Call uidoc.DeleteDocument
     End If
End Sub
0
jforget1
Asked:
jforget1
  • 2
1 Solution
 
scottrmaCommented:
Create a field in your document called SaveOptions and set its value to "0". That will prevent the save and also prevent the prompt to save from coming up.

Regards,

Scott
0
 
scottrmaCommented:
Something like this:

Msgbox "Thank you, but a survey has already been completed for your agency. "
Set doc = uidoc.Document
doc.SaveOptions = "0"
Call uidoc.Close

Regards,

Scott
0
 
jforget1Author Commented:
Thanks for the help, worked on the first try.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now