Difference between CopyItem method and doc1.field2=doc2.field2

Hi,

All is in subject. I want to know the difference between this two syntax :

Call doc1.CopyItem( doc2.field2 )

And

doc1.field2=doc2.field2

Thanks,

Julien

Subject: Difference between CopyItem method and doc1.field2=doc2.field2

if there is no field already created in doc1 then

doc1.field2 = doc2.field2

and

Call doc1.CopyItem( doc2.field2 )

will produce same result.

But if doc1 has already field “field2” then

Call doc1.CopyItem( doc2.field2 )

will create another field in doc1 and there will be 2 fields in the document with the same name but

doc1.field2 = doc2.field2

will only replace the value of field2 in doc1 with field2 value in doc2.

Hope you will got the idea.

Subject: RE: Difference between CopyItem method and doc1.field2=doc2.field2

cool Nasir,

Thanks for your help !

Subject: RE: Difference between CopyItem method and doc1.field2=doc2.field2

Actually there are other differences. The syntax

doc1.field2=doc2.field2

only copies the field value, and not any flags associated with that field. For instance, if field2 is a Readers field, this will not make the new item a Readers field if it wasn’t already.

The value copy with = is not exact for all datatypes. If the original field contains a date only, then the copied value will contain a date and a time (12:00:00) and the timezone of the computer running the code.

The = syntax won’t work for a rich text field.