Domino 9 und frühere Versionen > ND6: Entwicklung

error when I try to copy an intern field

(1/2) > >>

Toma Bogdan:
I receive the following error (attached file) when I try to copy an intern field

the code is:

--- Code: ---Set item_File = doc.GetFirstItem( "$File" )
If Not item_File  Is Nothing Then Call item_File.CopyItemToDocument( docnou, "$File" )
--- Ende Code ---

Glombi:
You have to copy the rich text field:

Example from Notes 5 Designer Help:

Dim docA As NotesDocument
Dim docB As NotesDocument
Dim rtitemA As Variant
Dim rtitemB As Variant
'...set values of docA and docB...
Set rtitemA = docA.GetFirstItem( "Body" )
Set rtitemB = docB.GetFirstItem( "Body" )
If ( rtitemA.Type = RICHTEXT And _
rtitemB.Type = RICHTEXT ) Then
  Call rtitemA.AppendRTItem( rtitemB )
  Call docB.Save( False, True )
End If

Andreas

Toma Bogdan:

--- Zitat von: Glombi am 11.06.04 - 15:21:34 ---You have to copy the rich text field:

Example from Notes 5 Designer Help:

Dim docA As NotesDocument
Dim docB As NotesDocument
Dim rtitemA As Variant
Dim rtitemB As Variant
'...set values of docA and docB...
Set rtitemA = docA.GetFirstItem( "Body" )
Set rtitemB = docB.GetFirstItem( "Body" )
If ( rtitemA.Type = RICHTEXT And _
rtitemB.Type = RICHTEXT ) Then
  Call rtitemA.AppendRTItem( rtitemB )
  Call docB.Save( False, True )
End If

Andreas

--- Ende Zitat ---
I receive the error Object variable not set at line rtitemB.Type = RICHTEXT ) Then !

PS. why my method works (in a similiar way with this method) for the Body field ?

TMC:
Toma,

There is no need to copy the $File - items. Just copy the Body-Richtext-Item via

Set itemMyBody = doc.GetFirstItem( "Body" )
If Not itemMyBody  Is Nothing Then Call itemBody.CopyItemToDocument( docnou, "BodyNew" )

The $File - items will be created automatically when you save the target document.

Toma Bogdan:

--- Zitat von: TMC am 11.06.04 - 15:31:13 ---Toma,

There is no need to copy the $File - items. Just copy the Body-Richtext-Item via

Set itemMyBody = doc.GetFirstItem( "Body" )
If Not itemMyBody  Is Nothing Then Call itemBody.CopyItemToDocument( docnou, "BodyNew" )

The $File - items will be created automatically when you save the target document.

--- Ende Zitat ---
it doesn't works because I have an ~~tmpid.ide file (an ID file backup) in the $File field of the mail document so when I copy this doc I can't see anything in the destionation doc (the Body field doesn't exist in the source document)

Navigation

[0] Themen-Index

[#] Nächste Seite

Zur normalen Ansicht wechseln