Migration/Conversion Help

I’m having a problem with an agent I’m creating in LS. First, I’m not great with Script, so I’ve been trying to piece together this code. This agent will run on selected documents that have been created using “Form A”. My mission is to migrate data from “Form A” to “Form B”, then delete the field from Form A. Some of the fields have the same data type but some are RT on Form A and Text on Form B, so I’m trying to convert the data. When I’m performing the conversion to RT, I got “Object Variable Not Set”. Here’s a sample of my code:

Sub Initialize

Dim sess As New NotesSession

Dim currdb As NotesDatabase

Set currdb = sess.CurrentDatabase

Dim frm As NotesForm

Set frm = currdb.GetForm("Form B")



Dim docColl As NotesDocumentCollection

Set docColl = currdb.UnprocessedDocuments

Dim rtitem As NotesRichTextItem

Dim currdoc As NotesDocument 

Dim contents As String



Set currdoc = docColl.GetFirstDocument

Do Until currdoc Is Nothing

	Set currdoc.form = frm

	Set rtitem = currdoc.GetFirstItem("Field from Form A")

	Set currdoc.Field from FormB = rtitem

	rtitem.Remove

currdoc.Field from Form B = currdoc.GetItemValue(“Field from Form A”)

	currdoc.RemoveItem("Field from Form A")

The first set of code is what I’m using for field conversion and the second set is what I’m using for fields with the same data type.

Am I on the right track?? Any assistance will be great.

Thanks