i've written a lotus notes program. it's a form which contains a button (for sending email) and a text field (it acts as a flag to control users from sending email more than once). it works in the "preview in notes" in the domino designer. however, when i copy the form (using Ctrl-A) and paste it in the a new memo in lotus notes, the error "Notes Error - Cannot locate field" is prompted. It seems the lotus notes cannot locate the field "EmailFlag" (please see below).
the source codes are shown below:
Sub Click(Source As Button)
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim flag As Integer
Set uidoc = workspace.CurrentDocument
Set doc = uidoc.Document
flag = uidoc.FieldGetText("EmailFlag")
If flag = 1 Then
Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
Set doc = New NotesDocument(db)
doc.Form = "Memo"
doc.SendTo = "email@example.com"
doc.Subject = "This is the email subject"
Set notesRichTextItem = doc.CreateRichTextItem("Body")
notesRichTextItem.AppendText("This is the email body.")
Call uidoc.FieldSetText("EmailFlag", "0")
Call doc.Save(True, False)
Call doc.Send( False )
does anyone know how to solve the problem? thanks!
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!