Notes Ninjas Notes Ninjas
Lotus Notes hints, tips, error messages
Add certain docs to folder depending on date

Hint Short Cut: Add this to your code & documentation to help you find this page.
http://www.notesninjas.com/#ArchiveToFolder or http://www.notesninjas.com/A555F9/nn.nsf/ByAlias/ArchiveToFolder

This is a bit of code that moves documents rejected before a certain date into a folder.


Put this into a button:

Dim s As New notessession
Dim db As notesdatabase

Set db = s.currentdatabase

defdate = s.getenvironmentstring("eDefDate")
deffolder = s.getenvironmentstring("eDefFolder")

If defdate="" Then defdate = Cstr(Today)
If deffolder="" Then deffolder = "RejectedAgesAgo"


d= Inputbox$("What date should they be created before?", "Date", defdate)
f=Inputbox$("What folder should they be put in?","Folder", deffolder)

Call s.setenvironmentvar("EDefDate", d)
Call s.setenvironmentvar("EDefFolder", f)

Dim col As notesdocumentcollection
Set col = db.ftsearch("",20)

Set SearchDate = New NotesDateTime("01/10/1999")

Selection = "Form = ""F1"" & Date1 <= @Adjust(" & d & ";0;0;0;0;0;0)"
Selection = "Form = ""F1"" & Date1 <= [" & d & "]"
Print Selection

Set Col = DB.Search(Selection, SearchDate, 0)
If Col.Count = 0 Then
Print "none found"
Else
Call col.putallinfolder(f)
Print "moved " & col.count
End If

Note a new folder is not shown on the folders view until the database is closed

and reopened. If you know a way aroud this let me know! 

 Jump to:     Notes Tips
    Lotus Notes Index 
  Register for Tips
Previous Lotus Notes Tip 
    Next Lotus Notes Tip
Your company logo here?
Adam Foster
Free Cash Making Web Site
Free Revenue Earning Blog Site
 Free Revenue Earning Newsletter Site   
Free Search Pages Free Web stats
Free Contact Us page
Cheap .com domain names
 Need a website or 
   Lotus Notes
  problem solved?
Adam Foster
Lotus Notes and Domino 6 Programming Bible by Brian Benz, Rocky Oliver
Covers all the programming techniques, concepts, and languages used with Notes and Domino, as well as the many new features of Domino 6 Thoroughly examines the Notes and Domino role with Java, XML, Web services, and other IBM products and technologies Provides extensive code and examples, many geared to the needs of administrators High-profile authors, known to their audience through conferences and articles Companion Web site shows example applications from the book running on a live Domino server and provides code download.
See at: Amazon.co.uk | Amazon.com |