tagger418
asked on
WARNING when Sending email from VBA in Access 97 through NOTES 6.5
Whenever I open an email from Notes 6.5 that was created and sent through VBA in Access 97 I get the following warning to pop up multiple times:
A stored form cannot contain computed subforms.
This is the code I am using (please excuse the sloppiness. I usually clean up after it is working correctly):
Public Function EmailUsers_WsId()
Dim session As Object
Dim db As Object
Dim doc As Object
Dim rtf1 As Object
Dim eo1 As Object, eo2 As Object, eo3 As Object, eo4 As Object, eo5 As Object
Dim vFilePrim As String, vFilePath As String
Dim vFileEvl As String
Dim vFileExp As String
Dim vFileP3 As String
Dim vFileSt As String
Dim txt_Body As String
Dim txt_EAdd As String
Dim txt_Subject As String
Dim txt_Ecc As String
Dim txt_EBcc As String
'vFileName = "Enter Path for Desired Attachment Here"
DoCmd.Hourglass True
'Start new Lotus Notes Session
Set session = GetObject("", "Notes.NotesSession")
'On Error GoTo Oops
'This line will tell Access which network path and database must be activated
'to send mail. GetDatabase(pServer As String, pFile As String, [bCreateonfail As Boolean = True])
'By default it will use the active mailbox if both REQUIREd arguments are entered as ""
Set db = session.GetDatabase("<SERV ER NAME REMOVED>", "mail\tgiaquin.nsf")
'Open Mail Database. This will prompt for a password if not already open-
'For full automation, Notes should already be open.
Call db.OPENMAIL
'Make new document
Set doc = db.CreateDocument
'Create body of message and email address
txt_Body = "SAMPLE TEXT. BODY NOT YET WRITTEN" & Chr(13) & Chr(13)
txt_EAdd = "Thomas Giaquinto"
txt_Subject = "SUBJECT DATE " & Date
'txt_Ecc = Nz(Forms![frm_sendem]![ctl _cc], "")
'txt_EBcc = Nz(Forms![frm_sendem]![ctl _bcc], "")
'Attachment path
vFilePath = "C:\Documents\"
vFilePrim = vFilePath & "1_Solutions.xls"
vFileEvl = vFilePath & "2_Solutions.xls"
vFileExp = vFilePath & "3_Solutions.xls"
vFileP3 = vFilePath & "4_Solutions.xls"
vFileSt = vFilePath & "5_Solutions.xls"
'Build e-mail
With doc
.Form = "Memo"
'.Form = "Reply"
.SaveMessageOnSend = True
.SendTo = txt_EAdd
'.cc = txt_Ecc
'.bcc = txt_Ecc
.Subject = txt_Subject
'Set rtf1 = .CreateRichTextItem(doc, "Body")
Set rtf1 = .CreateRichTextItem(doc, "Body")
'Import Text
Call rtf1.AppendText(txt_Body)
'Attach Files
Set eo1 = rtf1.EMBEDOBJECT(1454, "", vFilePrim)
Set eo2 = rtf1.EMBEDOBJECT(1454, "", vFileEvl)
Set eo3 = rtf1.EMBEDOBJECT(1454, "", vFileExp)
Set eo4 = rtf1.EMBEDOBJECT(1454, "", vFileP3)
Set eo5 = rtf1.EMBEDOBJECT(1454, "", vFileSt)
doc.Visible = True
'Send Mail
Call .Send(True)
MsgBox "An Email has been sent, Thank you.", vbInformation, "Confirmation"
DoCmd.Hourglass False
End With
'Deallocate Objects
Set rtf1 = Nothing
Set doc = Nothing
Set session = Nothing
DoCmd.Hourglass False
GoTo finished
Oops:
DoCmd.Hourglass False
MsgBox "Message Not Sent"
finished:
End Function
Any Suggestions?
~Tom
A stored form cannot contain computed subforms.
This is the code I am using (please excuse the sloppiness. I usually clean up after it is working correctly):
Public Function EmailUsers_WsId()
Dim session As Object
Dim db As Object
Dim doc As Object
Dim rtf1 As Object
Dim eo1 As Object, eo2 As Object, eo3 As Object, eo4 As Object, eo5 As Object
Dim vFilePrim As String, vFilePath As String
Dim vFileEvl As String
Dim vFileExp As String
Dim vFileP3 As String
Dim vFileSt As String
Dim txt_Body As String
Dim txt_EAdd As String
Dim txt_Subject As String
Dim txt_Ecc As String
Dim txt_EBcc As String
'vFileName = "Enter Path for Desired Attachment Here"
DoCmd.Hourglass True
'Start new Lotus Notes Session
Set session = GetObject("", "Notes.NotesSession")
'On Error GoTo Oops
'This line will tell Access which network path and database must be activated
'to send mail. GetDatabase(pServer As String, pFile As String, [bCreateonfail As Boolean = True])
'By default it will use the active mailbox if both REQUIREd arguments are entered as ""
Set db = session.GetDatabase("<SERV
'Open Mail Database. This will prompt for a password if not already open-
'For full automation, Notes should already be open.
Call db.OPENMAIL
'Make new document
Set doc = db.CreateDocument
'Create body of message and email address
txt_Body = "SAMPLE TEXT. BODY NOT YET WRITTEN" & Chr(13) & Chr(13)
txt_EAdd = "Thomas Giaquinto"
txt_Subject = "SUBJECT DATE " & Date
'txt_Ecc = Nz(Forms![frm_sendem]![ctl
'txt_EBcc = Nz(Forms![frm_sendem]![ctl
'Attachment path
vFilePath = "C:\Documents\"
vFilePrim = vFilePath & "1_Solutions.xls"
vFileEvl = vFilePath & "2_Solutions.xls"
vFileExp = vFilePath & "3_Solutions.xls"
vFileP3 = vFilePath & "4_Solutions.xls"
vFileSt = vFilePath & "5_Solutions.xls"
'Build e-mail
With doc
.Form = "Memo"
'.Form = "Reply"
.SaveMessageOnSend = True
.SendTo = txt_EAdd
'.cc = txt_Ecc
'.bcc = txt_Ecc
.Subject = txt_Subject
'Set rtf1 = .CreateRichTextItem(doc, "Body")
Set rtf1 = .CreateRichTextItem(doc, "Body")
'Import Text
Call rtf1.AppendText(txt_Body)
'Attach Files
Set eo1 = rtf1.EMBEDOBJECT(1454, "", vFilePrim)
Set eo2 = rtf1.EMBEDOBJECT(1454, "", vFileEvl)
Set eo3 = rtf1.EMBEDOBJECT(1454, "", vFileExp)
Set eo4 = rtf1.EMBEDOBJECT(1454, "", vFileP3)
Set eo5 = rtf1.EMBEDOBJECT(1454, "", vFileSt)
doc.Visible = True
'Send Mail
Call .Send(True)
MsgBox "An Email has been sent, Thank you.", vbInformation, "Confirmation"
DoCmd.Hourglass False
End With
'Deallocate Objects
Set rtf1 = Nothing
Set doc = Nothing
Set session = Nothing
DoCmd.Hourglass False
GoTo finished
Oops:
DoCmd.Hourglass False
MsgBox "Message Not Sent"
finished:
End Function
Any Suggestions?
~Tom
ASKER
I see both $Title and $Title_StoredForm
This is occur regardless of machine sent or received on as well as the Notes id used to send it.
If I only use the:
.Form = "Memo"
.SendTo = txt_EAdd
And comment out all other parts of the message I get the same results.
Thanks,
~tom
This is occur regardless of machine sent or received on as well as the Notes id used to send it.
If I only use the:
.Form = "Memo"
.SendTo = txt_EAdd
And comment out all other parts of the message I get the same results.
Thanks,
~tom
Do you have a Memo-form in the database you send from? Does it have the property "Store form in documents" set?
As an alternative, comment out the line with
.Form = "Memo"
Notes will use the default form (I hope)...
As an alternative, comment out the line with
.Form = "Memo"
Notes will use the default form (I hope)...
If you open the Memo form in Domino Designer, and look at the form properties, does the form have the Store Form with Document property?
ASKER
Currently I am just running the code from the VBA editor.
If I comment out: .Form = "Memo" the code cannot send the email.
unfortunately, I'm not a Notes Developer and I'm not really sure how to (or even if I can) open the memo form to check its properties.
If I comment out: .Form = "Memo" the code cannot send the email.
unfortunately, I'm not a Notes Developer and I'm not really sure how to (or even if I can) open the memo form to check its properties.
ASKER
I Fixed It, NEVER MIND!!
.Form = "Default"
.Form = "Default"
That will achieve exactly the same. Notes has a form with the name Memo, but not a form with the name Default. The result is that the default form (=Memo) will be used to open the mail.
Glad it's solved!
Glad it's solved!
Just a quick observation and very glad that you resolved the problem, but
Call .Send(True) << the true means to attach the form, so if you change that to call .send (false), I was wondering if you still get the errors?
Call .Send(True) << the true means to attach the form, so if you change that to call .send (false), I was wondering if you still get the errors?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What I don't get is that you see a message about "stored form". Is there a field called $Title in the Document Properties of the mail you received?