Solved

Deleting uidoc's back-end document

Posted on 2000-04-27
2
345 Views
Last Modified: 2013-12-18
Hi,
i have an uidoc(doc1). With an action button in it i want to create another document(doc2), copy some of the field values of the uidoc(doc1) to the new doc(doc2), close the uidoc(doc1), open the new doc(doc2) as uidoc(doc2) then delete the parent document(doc1).
I cant delete the parent doc 'cause it says can't delete document that has been instenciated by a uidoc or something like that.
I have looked to the help, it says you must close the uidoc, find again the the by it's universalID and then i will we able to delete it...it didn't work.
Good luck,
Koray.
0
Comment
Question by:koray_uygun
2 Comments
 
LVL 3

Accepted Solution

by:
Simon_Hendry earned 50 total points
ID: 2757353
What it is saying is that you have obtained the the doc1 notesdocument object via a notesuidocument and therefore  you can't delete it here is a work around , what you need to do is  close the uidoc1 , get the noteid of doc1,  remove the reference to the doc1 and get the reference to doc1 via a backend class like a notesdatabase and then delete it

heres the code to do it


Dim Sess As new Notessession
Dim ThisDB As NotesDatabase
Dim noteID as String

Set ThisDB = Sess.CurrentDatabase

..... Your Code goes here .....


' This gets the noteID to the document
 noteID = doc1.noteid
' This remove the in memory object            
  Delete doc1
' This closes the uidoc1
 Call uidoc1.Close()

' This finds the document via a backend class and deletes it
Set doc1 = thisDB.getdocumentbyid (noteID)
Call doc1.remove(True)

0
 

Author Comment

by:koray_uygun
ID: 2758421
Thank you again Simon.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

705 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now