Hi!
I'm trying to copy all the items in a document as I click the edit button. My fields are a combination of text and richtext fields. When I run this, I get an error message: "Function requires a valid ADT Argument".
I'm not sure what it means and I'm not sure if I can use "CopyAllItem" function so I don't have to identify each item in the form when I copy.
By the way, I intend to copy the items into another document of another dbase which I placed on my local.
Below is the procedure i tried for this:
Sub StatusApp(ws As notesuiworkspace, uidoc As notesuidocument, doc As notesdocument)
Dim docritem As NotesItem
Dim session As New notessession
Dim db As notesdatabase
Dim dbArchive As notesdatabase
Dim relate As NotesRichTextItem
Dim purpose As NotesRichTextItem
Dim outputs As NotesRichTextItem
Dim educ As NotesRichTextItem
Dim skill As NotesRichTextItem
Set db = session.currentdatabase
form = doc.Form(0)
If form = "JD" Then
key = doc.pagekey(0)
status = doc.STATUS(0)
title = doc.Title(0)
dept = doc.DEPARTMENT_1(0)
div = doc.DIVISION(0)
num = doc.NUMBER(0)
category = doc.CATEGORY(0)
location = doc.LOCATION(0)
level = doc.LEVEL(0)
update = doc.REVIEW_DATE(0)
dformat = doc.dformat(0)
Set relate = New NotesRichTextItem ( doc, "REP_RELATION" )
Set purpose = New NotesRichTextItem ( doc, "PURPOSE" )
Set outputs = New NotesRichTextItem ( doc, "OUTPUTS" )
ccs = doc.CORE_COMP_AS(0)
ccn = doc.CORE_COMP_NO(0)
ks = doc.KR_SUP(0)
ki = doc.KR_IC(0)
ke = doc.KR_EC(0)
kds = doc.KR_DUTIES_SUP(0)
kdi = doc.KR_DUTIES_IC(0)
kde = doc.KR_DUTIES_EC(0)
Set educ = New NotesRichTextItem ( doc, "EDUC" )
Set skill = New NotesRichTextItem ( doc, "SKILL" )
num1 = doc.NUM_1(0)
update = doc.UPDATED(0)
Set docritem = doc.GetFirstItem("Content")
Call uidoc.Close
Set dbArchive = session.GetDatabase ("","vacmonArchive.nsf")
Set newdoc = dbArchive.createdocument()
newdoc.form = "JobDesc_New"
newdoc.status = "Draft"
newdoc.pagekey = key
newdoc.Title = title
newdoc.DEPARTMENT_1 = dept
newdoc.DIVISION = div
newdoc.NUMBER = num
newdoc.CATEGORY = category
newdoc.LOCATION = location
newdoc.LEVEL = level
newdoc.REVIEW_DATE = update
newdoc.dformat = dformat
Set relate = New NotesRichTextItem ( newdoc, "REP_RELATION" )
Set purpose = New NotesRichTextItem ( newdoc, "PURPOSE" )
Set outputs = New NotesRichTextItem ( newdoc, "OUTPUTS" )
newdoc.CORE_COMP_AS = ccs
newdoc.CORE_COMP_NO = ccn
newdoc.KR_SUP = ks
newdoc.KR_IC = ki
newdoc.KR_EC = ke
newdoc.KR_DUTIES_SUP = kds
newdoc.KR_DUTIES_IC = kdi
newdoc.KR_DUTIES_EC = kde
Set educ = New NotesRichTextItem ( newdoc, "EDUC" )
Set skill = New NotesRichTextItem ( newdoc, "SKILL" )
newdoc.NUM_1 = num1
newdoc.UPDATED = update
Call newdoc.CopyItem(docritem,"Content")
Messagebox "Document Saved"
Set uidoc = ws.Editdocument(True,newdoc)
Call uidoc.GotoField("Content")
End If
End Sub
.. So sorry for the long code, but any help is truly, truly, appreciated!
best regards,
tin
I'm trying to copy all the items in a document as I click the edit button. My fields are a combination of text and richtext fields. When I run this, I get an error message: "Function requires a valid ADT Argument".
I'm not sure what it means and I'm not sure if I can use "CopyAllItem" function so I don't have to identify each item in the form when I copy.
By the way, I intend to copy the items into another document of another dbase which I placed on my local.
Below is the procedure i tried for this:
Sub StatusApp(ws As notesuiworkspace, uidoc As notesuidocument, doc As notesdocument)
Dim docritem As NotesItem
Dim session As New notessession
Dim db As notesdatabase
Dim dbArchive As notesdatabase
Dim relate As NotesRichTextItem
Dim purpose As NotesRichTextItem
Dim outputs As NotesRichTextItem
Dim educ As NotesRichTextItem
Dim skill As NotesRichTextItem
Set db = session.currentdatabase
form = doc.Form(0)
If form = "JD" Then
key = doc.pagekey(0)
status = doc.STATUS(0)
title = doc.Title(0)
dept = doc.DEPARTMENT_1(0)
div = doc.DIVISION(0)
num = doc.NUMBER(0)
category = doc.CATEGORY(0)
location = doc.LOCATION(0)
level = doc.LEVEL(0)
update = doc.REVIEW_DATE(0)
dformat = doc.dformat(0)
Set relate = New NotesRichTextItem ( doc, "REP_RELATION" )
Set purpose = New NotesRichTextItem ( doc, "PURPOSE" )
Set outputs = New NotesRichTextItem ( doc, "OUTPUTS" )
ccs = doc.CORE_COMP_AS(0)
ccn = doc.CORE_COMP_NO(0)
ks = doc.KR_SUP(0)
ki = doc.KR_IC(0)
ke = doc.KR_EC(0)
kds = doc.KR_DUTIES_SUP(0)
kdi = doc.KR_DUTIES_IC(0)
kde = doc.KR_DUTIES_EC(0)
Set educ = New NotesRichTextItem ( doc, "EDUC" )
Set skill = New NotesRichTextItem ( doc, "SKILL" )
num1 = doc.NUM_1(0)
update = doc.UPDATED(0)
Set docritem = doc.GetFirstItem("Content")
Call uidoc.Close
Set dbArchive = session.GetDatabase ("","vacmonArchive.nsf")
Set newdoc = dbArchive.createdocument()
newdoc.form = "JobDesc_New"
newdoc.status = "Draft"
newdoc.pagekey = key
newdoc.Title = title
newdoc.DEPARTMENT_1 = dept
newdoc.DIVISION = div
newdoc.NUMBER = num
newdoc.CATEGORY = category
newdoc.LOCATION = location
newdoc.LEVEL = level
newdoc.REVIEW_DATE = update
newdoc.dformat = dformat
Set relate = New NotesRichTextItem ( newdoc, "REP_RELATION" )
Set purpose = New NotesRichTextItem ( newdoc, "PURPOSE" )
Set outputs = New NotesRichTextItem ( newdoc, "OUTPUTS" )
newdoc.CORE_COMP_AS = ccs
newdoc.CORE_COMP_NO = ccn
newdoc.KR_SUP = ks
newdoc.KR_IC = ki
newdoc.KR_EC = ke
newdoc.KR_DUTIES_SUP = kds
newdoc.KR_DUTIES_IC = kdi
newdoc.KR_DUTIES_EC = kde
Set educ = New NotesRichTextItem ( newdoc, "EDUC" )
Set skill = New NotesRichTextItem ( newdoc, "SKILL" )
newdoc.NUM_1 = num1
newdoc.UPDATED = update
Call newdoc.CopyItem(docritem,"Content")
Messagebox "Document Saved"
Set uidoc = ws.Editdocument(True,newdoc)
Call uidoc.GotoField("Content")
End If
End Sub
.. So sorry for the long code, but any help is truly, truly, appreciated!
best regards,
tin