?
Solved

Closing form without saving

Posted on 2003-02-19
3
Medium Priority
?
215 Views
Last Modified: 2013-12-18
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
Comment
Question by:jforget1
[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
  • 2
3 Comments
 
LVL 7

Expert Comment

by:scottrma
ID: 7983900
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
 
LVL 7

Accepted Solution

by:
scottrma earned 140 total points
ID: 7983935
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
 

Author Comment

by:jforget1
ID: 7987019
Thanks for the help, worked on the first try.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses
Course of the Month14 days, 7 hours left to enroll

770 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