I have a child document that contains a hot button that when clicked will execute the @command(MailComposeMemo) creating a new blank email. I am also loading the “To:” and “Subject:” field - (see below). When I run this code I get an error message “Cannot Locate Field” but when I click OK the message dissappears and the information is there like I wanted. Why am I getting this error message and is there any way to bypass it ? Thanks.
On Error Goto ERRTRAP
Dim s As New NotesSession
Dim workspace As New NotesUIWorkspace
Dim db As NotesDatabase
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim item As NotesItem
’ Dim copyto(1 To 2) As String
Set uidoc=workspace.currentdocument
Set doc=uidoc.document
Set db=s.currentdatabase
If uidoc.IsNewDoc Then
Call uidoc.Save
End If
comm$ = (uidoc.FieldGetText( "Subject" ))
cp$ = Trim(uidoc.FieldGetText( "CompName" ))
fn$ = Trim(uidoc.FieldGetText( "ContactName" ))
ln$ = Trim(uidoc.FieldGetText( "ContactName_1" ))
If Trim(comm$) = "" Then
Msgbox "Please enter the SUBJECT to email"
Exit Sub
End If
Set item = doc.GetFirstItem( "Subject" )
Set memo = New NotesDocument( db )
Call item.CopyItemToDocument( memo, "Body" )