Agent to run on different DB

I created a button under a test form on DB1 w/ some lotusscript code in it. It goes to DB2 and makes changes to a specific doc in DB2. It works fine. I would like to take the lotusscript code and run as an agent on DB1. Please help

Subject: agent to run on different DB

Use the Open command to get a handle on the database, thusly:

Dim db_nothisdb As New NotesDatabase( “”, “” )

Call db_nothisdb.Open( “Servername”, “whatever.nsf” )