Copy values from one form to another

I’m not using a response document.I’d like to copy information off one form to fields on another form when I create the new form. I’m using a action button on the origional to create the new form.

I assume, I should copy the information into a variable

I’m trying to pass a key number to the new document. fields in both documents = “num_key”

Dim vnum_key As Double

vnum_key# = num_key

@Command([Compose]; “” ; “Inspection” :wink:

key_num =: vnum_key

Why does this not work?

Thanks in addvance

Jim Lamb

Subject: copy values from one form to another

It doesn’t work, first and foremost, because it appears that you’re mixing LotusScript and @formulas, which simply won’t work. The LotusScript routine already posted will do the job, but there’s a much easier way to do it. Here’s what to do: In the form properties for the form you want to inherit information, go to the second (Defaults) tab and check “Formulas inherit values from selected document”. Set the default value of the field to num_key (that is, type in the bare word; put no quotation marks around it). When you create the new document, it’ll inherit values from the open document for field value formulas, even though it’s not a response document.

Subject: copy values from one form to another

if the fieldnames are the same in both the forms, then you can set the forms to Inherit values from existing document, see the second tab in form properties.

else the correct way is as follows:

dim s as new notessession

dim ws as new notesuiworkspace

dim uidoc as notesuidocument

dim doc as notesdocument

dim db as notesdatabase

set db = s.currentdatabase

set uidoc = ws.currentdocument

set doc = db.createdocument

doc.form = “formname”

doc.key_num = uidoc.getfieldtext(“key_num”)

ws.editdocument doc,see help for parameters