I have a button in a form that when pressed puts the username and date as well as other information. Where/How can I get it to put in the current time as well right next to the date? Here is the code:Sub Click(Source As Button)
Dim w As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim newuidoc As NotesUIDocument
Dim docA As NotesDocument
Dim session As New NotesSession
Dim dateTime As New NotesDateTime( "Today" )
Dim user As String
Dim temp As Variant
Dim rtitemA As Variant
Dim rtitemB As Variant
Dim rtitemC As Variant
Dim eo As Variant
user = session.CommonUserName
temp = "C:\"
Set uidoc = w.CurrentDocument
Set docA = uidoc.Document
Dim flag As Integer
flag = uiDoc.DialogBoxCanceled
If flag Then
Exit Sub
End If
If Not uidoc.Editmode Then uidoc.EditMode = True
Set rtitemA = docA.GetFirstItem( "UDate" )
Set rtitemB = docA.GetFirstItem( "Update" )
Set rtitemC = docA.GetFirstItem( "Information" )
If ( rtitemA.Type = RICHTEXT And rtitemB.Type = RICHTEXT And rtitemC.Type = RICHTEXT ) Then
’ *** Append the latest entry to the history field
Call rtitemC.AddNewLine(2)
Call rtitemC.AppendRTItem( rtitemA )
Call rtitemC.AddNewLine(1)
Call rtitemC.AppendRTItem( rtitemB)
’ *** Copy attachments
On Error Goto a1
’ If Not rtitemB.EmbeddedObjects Is Nothing Then
Forall o In rtitemB.EmbeddedObjects
If ( o.Type = EMBED_ATTACHMENT ) Then
Call o.ExtractFile( temp & o.Source )
Call rtitemC.AddNewLine(1)
Call rtitemC.AppendText("** DON'T DELETE ")
Call rtitemC.EmbedObject( o.Type, "", temp & o.Source)
Kill temp & o.Source
End If
End Forall
’ End If
Goto a2
a1:
On Error Goto 0
Resume a2
a2:
'set the SaveOptions field so that when the uidoc is closed, the user won’t be asked to save
Call docA.Save(True,True)
docA.SaveOptions = "0"
’ close the uidoc. It won’t actually happen until the code is finished executing
Call uidoc.Close(True)
’ create a new uidoc and open the backend doc that is still in memory with added doc link
Set newuidoc = w.EditDocument(True, docA)
’ delete the reference to the old uidoc
Delete uidoc
’ re-associate the variable with the backend doc
Set docA = newuidoc.Document
’ remove the SaveOptions field so the doc can be saved
Call docA.RemoveItem( "SaveOptions" )
Call newuidoc.FieldSetText("Update", Chr(10)+Chr(10))
Call newuidoc.FieldSetText("UDate", ">>> " & dateTime.LocalTime & " - " & user)
Call newuidoc.GoToField("Update")
End If
End Sub
Thanks for the help!