Ask the Expert

Transfer values from one field to another

How can I transfer the values from one field to another field (the two fields are in different forms & different databases)? Can I use ASP or XML? Is it need any separate database connectivity? Or else I can use the Notes database?

The good news is this is fairly simple and can be done in numerous ways, the following LotusScript code illustrates one simple way to do it assuming that you want to move values from the currently selected document (source) to another document in the target database (target). It could easily be extended to support virtually any scenario for moving data.

Dim nsCurrent as New NotesSession
Dim ndbSource as NotesDatabase, ndbTarget as NotesDatabase
Dim nvwTarget as NotesView
Dim ndocSource as NotesDocument, ndocTarget as NotesDocument
Set ndbSource = nsCurrent.CurrentDatabase
Set ndbTarget = nsCurrent.getDatabase(ndbSource.Server, "target.nsf")
Set nvwTarget = ndbTarget.getView("target")
Set ndocTarget = nvwTarget.getDocumentByKey("target",true)
If Not ndocTarget is Nothing Then
	ndocTarget.targetFieldName=ndocSource.sourceFieldName
Else
	MsgBox "Could not access target document", 16, "Error"

End if

This was first published in March 2002

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: