Lotus 错误 "Could not create field %1"

来源:互联网 发布:遥感卫星数据 编辑:程序博客网 时间:2024/06/05 19:09
  

While running LotusScript code, the following error message occurs:


    "Could not create field %1"

What does this error mean?

Answer

This error is displayed when you try to assign an invalid array to a field. Examples of invalid arrays would be an array containing different data types, or an array that would exceed the storage capacity of the field.

A simple example code that generates this error would be as follows:
Sub Initialize
Dim sess As New notesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim arr(1) As Variant

Set db = sess.CurrentDatabase
Set doc = db.CreateDocument

arr(0) = ""
arr(1) = Datevalue("1 Jan 2004")
doc.NewField = arr
End Sub

Note that a different error is displayed if you use the ReplaceItemValue method of the NotesItem class, rather than the "dot" notation that treats the field as a property of the document. If you replace this line:

    doc.NewField = arr

in the example above with:
    Call doc.ReplaceItemValue("NewField", arr)

you see the error message:
    Notes error: NotesItem cannot be set to an array of mixed data types

In the case of an array that would exceed the capacity of the field, the error message when using ReplaceItemValue is

    Notes error: Adding entry will cause text list to exceed 64K. Entry not added
原创粉丝点击