sendobject with False not automatically sending email

A

AllyB

All,

Once again I'm turning to the world of experts! I have a database that
tracks all our current projects. As a new project is initiated, I want to
have a form completed with the critical information and have it sent to a
central person for entry into the database. I have the form, I'm able to
complete it and send it in email but the email itself does not close
automatically. I thought by using the "False" option at the end of the
docmd.sendobject command, it would force sending of the email without the
email client (Lotus Notes, in this case) opening up.

I've attached the code below:

Private Sub cmdSubmitNewProject_Click()

Dim strSendToEmail As String
Dim strFormName As String
Dim strSubLine As String
Dim strBodyText As String

strSendToEmail = "(e-mail address removed)"
strFormName = "InitialProjectData"
strSubLine = "A new project request has been submitted"
strBodyText = "A new project request form has been completed and submitted"

DoCmd.SendObject acSendForm, strFormName, acFormatTXT, strSendToEmail, ,
, strSubLine, , False

End Sub

I'm not sure if it's because I'm using Notes, or if it's something in my
code. Any and all help, as always, very much appreciated!

Oh, and it's Access 2003, SP3 with Lotus Notes 7.0.1
 
A

AllyB

Hi Alex,

Thanks so much for this. While it didn't exactly work, I was able to figure
out enough to get it to work...not bad for someone who hasn't coded in over
10 years, I guess!

In case anyone is interested, this is what I ended up doing:

Public Sub SendLotusNotesMail(strMailTitle As String, strLotusNotesUserID As
String, strTextBody As String)

Dim objAttachment As Object
Dim objMailDb As Object
Dim objMailDocument As Object
Dim objEmbedObject As Object
Dim objNotesSession As Object

Dim strMailDbName As String

On Error Resume Next

'Start objNotesSession in Lotus Notes
Set objNotesSession = CreateObject("Notes.NotesSession")

'Open the mail database in Lotus Notes
Set objMailDb = objNotesSession.GETDATABASE("", strMailDbName)
objMailDb.OPENMAIL

'Set up the new mail document
Set objMailDocument = objMailDb.CREATEDOCUMENT
objMailDocument.Form = "Memo"
objMailDocument.sendto = strLotusNotesUserID
objMailDocument.Subject = strMailTitle
objMailDocument.Body = strTextBody

'Send the document
objMailDocument.SEND 0, strLotusNotesUserID

'Clean Up
Set objMailDb = Nothing
Set objMailDocument = Nothing
Set objAttachment = Nothing
Set objNotesSession = Nothing
Set objEmbedObject = Nothing

End Sub

Private Sub cmdSubmitNewProject_Click()

Dim strSendToEmail As String
Dim strSubLine As String
Dim strBodyText As String

'set email content values
strSendToEmail = "(e-mail address removed)"
strSubLine = "A new project request has been submitted"
'use controlname.value to send requested values and vbcrLF to create linefeeds
strBodyText = "Planview ID: " & PlanviewID.Value & vbCrLf & _
"Project Name: " & ProjectName.Value & vbCrLf & _
"Project Description: " & ProjectDescription.Value & vbCrLf & _
"Portfolio Name: " & PortfolioName.Value & vbCrLf & _
"Project Manager: " & ProjectManager.Value & vbCrLf & _
"Sponsor: " & Sponsor.Value & vbCrLf & _
"Executive Sponsor: " & ExecutiveSponsor.Value & vbCrLf & _
"Program Name: " & ProgramName.Value & vbCrLf & _
"FBPM: " & FBPM.Value & vbCrLf & _
"PMO Liaison: " & PMOLiaison.Value & vbCrLf

Call SendLotusNotesMail(strSubLine, strSendToEmail, strBodyText)

End Sub

I'm going home now...

AB
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top