I have the following code which is returning the error “Item RejectionResubmitted is not of type Text, special type not set”.
If (doc.HasItem(“RejectionResubmitted”)) Then
Dim itemResubmitted As NotesItem
Set itemResubmitted = doc.GetFirstItem(“RejectionResubmitted”)
If (itemResubmitted.Values(0) = “”) Then
Set itemResubmitted.Values = x
Else
'Here is where the error occurs
Call itemResubmitted.AppendToTextList(x)
End If
Else
doc.RejectionResubmitted = x
End If
The error occurs in the line “Call itemResubmitted.AppendToTextList(x)”,
RejectionResubmitted is a date/time list. When itemResubmitted is set, it becomes a variant. x is the date/time that I set when when the agent begins running so that all times are the same. I’ve tried to use Cstr(x) and Cstr(Now()), but these give the same error.
How do I append the current date/time to the existing field?
What’s the type of field RejectionResubmitted in your Form?It looks like that field is Numeric, or atleast it can’t accept a Text vaue. Try assigning a number, or data type matching with what is set Form Field.
PS (from help file):
For writing, the data type of Values determines the data type of the item.
Data type of value Resulting NotesItem
String Text item containing the value
Array of String Text item containing each element of the value
Long, Integer, Double, Single, or Currency Number item containing the value
Array of Long, Integer, Double, Single, or Currency Number item containing each element of the value
Variant of type DATE, NotesDateTime, or NotesDateRange. Date-time item containing the value
Array of Variant of type DATE, array of NotesDateTime, or array of NotesDateRange Date-time item containing each element of the value
NotesItem Item whose data type matches the NotesItem type and whose value(s) match the NotesItem value(s)
There is a difference between NotesDateTime object in LotusScript, and Date/Time field in a Form. These two are not interchangeable. Here is an example of modifying Date/Time field in a Form/Document using NotesDateTime object:
As shown in following example try using doc.ReplaceItemValue (instead of assigning the date to vlaues attribute).
Dim session As New NotesSession
Dim db As NotesDatabase
Dim dateTime As NotesDateTime
Dim c As NotesDocumentCollection
Dim doc As NotesDocument
Dim scheditem As NotesItem
Set db = session.CurrentDatabase
Set dateTime = New NotesDateTime(“09:00 PM”)
Set c = db.AllDocuments
Set doc = c.GetFirstDocument()
Set scheditem = doc.ReplaceItemValue(“Schedule”, dateTime)