Agent won't run. No documents are selected. Help!

I would like to copy all the documents from one database to another, so I created the following agent (with Domino Designer’s Help help):

Dim session As New NotesSession

Dim oldSIR As NotesDatabase

Dim newSIR As NotesDatabase

Dim dc As NotesDocumentCollection

Dim doc As NotesDocument

Set oldSIR = session.CurrentDatabase

Set newSIR = New NotesDatabase _

("", "Domino DBs\Revised SIRs\WDES\SIR for WDES.nsf")

Set dc = oldSIR.AllDocuments

Set doc = dc.GetFirstDocument()

While Not(doc Is Nothing)

Call doc.CopyToDatabase(newSIR)

Set doc = dc.GetNextDocument(doc)

Wend

I have entered a condition for document selection: “In folder ”.

When I try running the agent, however, I get the following message: “Action Failed. To run this agent you must have at least one document selected.”

Is there anything I missed?

Subject: Agent won’t run. No documents are selected. Help!

Hi Lynda

Yep - you missed the agent properties.

You are using the NotesDatabase.AllDocuments (Set dc = oldSIR.AllDocuments) which means that you dont need the agent it self to select any document.

In the agent properties, in the “Basics” page, in the section “Runtime”, select the target to “None”.

If you need to get the selection from the agent, you sould use the target “All Documents in database” and make a document selection as you have descriped.

To optain these documents, use the NotesDatabase.UnprocessedDocuments, changing the line “Set dc = oldSIR.AllDocuments” to “Set dc = oldSIR.UnprocessedDocuments”.

Try it…

Hope it helps…

Christian Gravgaard

Theilgaard Mortensen A/S

Subject: RE: Agent won’t run. No documents are selected. Help!

Hi, Christian!Thanks for your response.

I’ve tried doing it both ways, but nothing happens when I run (or try running) the agent…

Subject: RE: Agent won’t run. No documents are selected. Help!

Change your selection criteria in the agent properties. Select “all” or “new and modified”, not what you have selected.

You will find answers to common mistakes and tips on troubleshooting here:

http://www-10.lotus.com/ldd/46dom.nsf/7e6c7e584a76331b85256a46006f083e/574c99ccb345839185256976004e811e?OpenDocument