DoCmd.SendObject Used In Multiple Email Buttons

Have found some code that originated from this forum, and have modified it to suit my needs. There's one form with all the information, that has multiple buttons and subsequently multiple functions to generate emails, with each button/email to generate a different format and content. The first use of a button works fine, but trying to use the next button right after does nothing. If you exit the form and re-enter, you can then use the next email button, but that's a pain and the users won't like that. Can anyone help? I've pasted a sample of the code that is being used below, it's duplicated and changed slightly for the other buttons. I currently have the button linked to a macro that does other things like saving, and setting dates and then running the function.

Public Function AckEmailNew()
On Error GoTo Err_cmdMailTicket_Click

Dim varTo As String '-- Address for SendObject
Dim stText As String '-- E-mail text
Dim stSubject As String '-- Subject line of e-mail
Dim stTicketID As String '-- The ticket ID from form
Dim strSQL As String '-- Create SQL update statement
Dim errLoop As Error

varTo = Me.ClientEmail
stTicketID = Me.STSITicket

stSubject = "Ticket/numéro de référence: " & stTicketID

stText = <<My text goes here>>

'Write the e-mail content for sending to assignee
DoCmd.SendObject , , acFormatTXT, varTo, , , stSubject, stText, -1

On Error GoTo Err_Execute

Exit Function


MsgBox Err.Description
Resume Exit_cmdMailTicket_Click

Exit Function

MsgBox Err.Description
Resume Exit_cmdMailTicket_Click

End Function

View Replies


Remove Warning When Sending An Email Using Docmd.sendobject - Version: 2000 (9.0)


While trying to send emails through access, outlook prompts "A program is trying to send an email on your behalf. Do you want to allows this"

Does anyone know how to prevent this from happening, either through access or outlook itself??
I'm trying to send several emails at once and its a big nuisance to have to click yes each time.


View Replies View Related

How To Send Two Reports In One Email Via DoCmd.SendObject AcSend - Version: 2007 (12.0)

i currently send a report to a reciepient using the Docmd.Sendobject acSendReport which works really well - now my customer wants two reports sent in the same email..

Any thoughts???

View Replies View Related

DoCmd.SendObject For Multiple Attachments - Version: 2003 (11.0)

I am trying to use the DoCmd.SendObject in a VBA module to send two reports as attachments. I can get this to work just fine with one, but I cannot get this function to send two reports. Is this even possible?

View Replies View Related

Multiple Email Addresses In SendObject

Im using the code below to send information by email. BUT:

I want to send the same information to more than one recipient. can i write more than one address in the SendObject?

What can i do if i do not know prior to sending how many addresses i want to include. (this means that once i might have tosend it to 1, then later to 3, etc...)?

The code is:

Private Sub cmdMailTicket_Click()
On Error GoTo Err_cmdMailTicket_Click

Dim stWhere As String '-- Criteria for DLookup
Dim varTo As Variant '-- Address for SendObject
Dim stText As String '-- E-mail text
Dim RecDate As Variant '-- Rec date for e-mail text
Dim stSubject As String '-- Subject line of e-mail
Dim stTicketID As String '-- The ticket ID from form
Dim stWho As String '-- Reference to tblUsers
Dim stHelpDesk As String '-- Person who assigned ticket
Dim strSQL As String '-- Create SQL update statement
Dim errLoop As Error

'-- Combo of names to assign ticket to
stWho = Me.cboAssignee
stWhere = "tblUsers.strUserID = " & "'" & stWho & "'"
'-- Looks up email address from TblUsers
varTo = DLookup("[strEMail]", "tblUsers", stWhere)

stSubject = ":: New Help Desk Ticket ::"

stTicketID = Format(Me.txtTicketID, "00000")
RecDate = Me.txtDateReceived
'-- Helpdesk employee who assigns ticket
strHelpDesk = Me.cboReceivedBy.Column(1)

stText = "You have been assigned a new ticket." & Chr$(13) & Chr$(13) & _
"Ticket number: " & stTicketID & Chr$(13) & _
"This ticket has been assigned to you by: " & strHelpDesk & Chr$(13) & _
"Received Date: " & RecDate & Chr$(13) & Chr$(13) & _
"This is an automated message. Please do not respond to this e-mail."

'Write the e-mail content for sending to assignee
DoCmd.SendObject , , acFormatTXT, varTo, , , stSubject, stText, -1

'Set the update statement to disable command button
'once e-mail is sent
strSQL = "UPDATE tblHelpDeskTickets SET tblHelpDeskTickets.ysnTicketAssigned = -1 " & _
"Where tblHelpDeskTickets.lngTicketID = " & Me.txtTicketID & ";"

On Error GoTo Err_Execute
CurrentDb.Execute strSQL, dbFailOnError
On Error GoTo 0

'Requery checkbox to show checked
'after update statement has ran
'and disable send mail command button
Me.cmdMailTicket.Enabled = False

Exit Sub


' Notify user of any errors that result from
' executing the query.
If DBEngine.Errors.Count > 0 Then
For Each errLoop In DBEngine.Errors
MsgBox "Error number: " & errLoop.Number & vbCr & _
Next errLoop
End If

Resume Next

Exit Sub

MsgBox Err.Description
Resume Exit_cmdMailTicket_Click

End Sub

View Replies View Related

Multiple Email Buttons One Access Form!!!

Hello to all the Users!
I am new at Access and new to programming.
I have created an Access form that has four labeled control buttons each one with an individuals name. I have the corresponding code:

Private Sub Email_PersonOne_Click()
DoCmd.SendObject acSendNoObject, , , "", , , "Work Request", "A new work request has been submitted."
End Sub

When I have one button and one code the email function works. I want the users to be able to select one out of four people who they want to notify upon completion of the form. So I have four buttons and changed the email address and the names on the buttons but now none of the buttons work.
The code is on the same page separated with just a line between each section.

Does this make sense?
Any input would be greatly appreciated.
Thanks in advance for your time and help.

View Replies View Related



I have spent sometime working on sending access reports to customers as asFormatHTML.

Code:DoCmd.SendObject acSendReport, "rptConfirm", acFormatHTML, strEmail, , , "Trade Confirms from Kyte Options " & date, , no, False

Trouble is some of my customers cannot read the attachment! Is it possible to have the message body display a txt of the report/query?

Thanks for any help you can give.

View Replies View Related

DoCmd.SendObject AcReport

I am trying to find a way to use the "DoCmd.SendObject acReport" feature WITHOUT using Outlook. Does anybody know of any code or a setting that will enable me to specify another e-mail program, such a Thunderbird?

I should add that I am using Access 2002, SP3, running in Windows XP Professional, Version 2002, Service Pack 2.



View Replies View Related

Send Mail (not Using Docmd.Sendobject)

This might come in handy for sending mail, also if you want to bypass the Outlook 2000/2002 security update.

Dim safemail As Variant
Dim myOlApp
Dim myItem
Dim myRecipient
Dim myBody
Dim myfolder
Dim mynamespace
Dim myAttachments

Set myOlApp = CreateObject("Outlook.Application.9")
Set myItem = myOlApp.CreateItem(0)
Set safemail = CreateObject("Redemption.SafeMailItem")
Set safemail.Item = myItem
Set myRecipient = safemail.Recipients.Add("")
Set mynamespace = myOlApp.GetNamespace("MAPI")
Set myfolder = mynamespace.GetDefaultFolder(5)
safemail.Subject = "Your Subject"
safemail.Body = "Your Body"
safemail.ReadReceiptRequested = True
safemail.OriginatorDeliveryReportRequested = True
Set myOlApp = Nothing
Set safemail = Nothing
MsgBox "Mail Sent", vbInformation, "Mail Sent..."

This uses Dmitry Streblechenko's Redemption object written for bypassing the Security update.

Can be downloaded from

Hope this can help people.


View Replies View Related

DoCmd.SendObject - Version: 2003 (11.0)


I use DoCmd.SendObject acSendNoObject... to generate a email in Outlook Office XP.

This way of generating a email skips adding my signature to the end of the email. Inserting it manualty is the only option left.

Is there a way to force adding a signature?


View Replies View Related

DoCmd.SendObject - Version: 2003 (11.0)

I am perplexed at this command; I am using to send a "form" with 12 fields that user must fill. All is well and it sends email(as it should). However, the email received shows 12 copies of one record. The code is as follows;

DoCmd.SendObject acSendForm, frmUserRegister, "HTML(*.html)", "", "","" ,TRUE , ""

View Replies View Related

DoCmd.SendObject From Setting - Version: 2002 (10.0) XP

In looking at the syntax to send an object from code, I don't see where you can set the "from" in the email. Is there a way to do this?

DoCmd.SendObject(ObjectType, ObjectName, OutputFormat, To, Cc, Bcc, Subject, MessageText, EditMessage, TemplateFile)


View Replies View Related

DoCmd.SendObject & E-mail - Version: 2003 (11.0)


I am using the DoCmd.SendObjecct command to automatically generate an e-mail.

The Acutal code I use is:

DoCmd.SendObject acSendNoObject, , , "", , , "My Email Subject", "My Email Text", False

This works just fine with one small exception. The e-mail gets placed in the outbox and won't get sent until you open Outlook and allow it/force it to send/receive.

Is there anyway to force the e-mail to actually get sent immediately instead of getting placed in the outbox and possibly never getting sent?

Thanks for your help.


View Replies View Related

DoCmd.SendObject Failing On 1 Of 4 PC - Version: 2003 (11.0)

I'm having a problem in which I can get 3 users on separate PCs to send an email from a form, using the DoCmd.SendObject function, but user #4 can not. All users are on Access 2003 and Outlook 2003. They all use the same front end mdb file. Is there a dependency that SendObject needs, that may not be loaded onto PC #4 ??? I'd also appreciate some comments as to how I may be able to troubleshoot this, if an answer is not readily available. At present User #4 gets the error message, based on the On Error function.
Thanks in advance.

View Replies View Related

DoCmd.SendObject (Need To Use Emails From Query) - Version: 2003 (11.0)

I need to use the DoCmd.SendObject method in my code using an email field from a query in the email argument. I have made a query that has 10 or so emails in its results. I will need to use all ten of these emails in the DoCmd.SendObject code argument. Does anyone know how to call the query data into the method?

View Replies View Related

DoCmd.SendObject Error With MS Outlook - Version: 2000 (9.0)

I use the code below to send a table from my db as an attachment. It works well except on one users pc. When she clicks the button that this is under she gets the following error message "The operation falied due to netowrk or other communication problems. Check your connections and try again.". I'm using Access 2000 and MS Outlook for the email. Is it in the setup of her MS Outlook?

Dim strTableName As String.....

View Replies View Related

Images In DoCmd.SendObject Emails? - Version: 2003 (11.0)

Does anyone one know how/if it is possible to add images to emails generated using DoCmd.SendObject Emails?

I have had a sniff through the forum but doesn't look like anybody has asked this before...

Thanks in advance

View Replies View Related

Docmd.sendobject Use A Outlook Template - Version: 2002 (10.0) XP

Hi all, wonder if someone could help.
I want to send a Access report using an outlook email template.

Here is my current code - could someone tell me how to finish off this code so my template is used. Many thanks

Private Sub Mail_Profile_Click()
On Error GoTo Err_Mail_Profile_Click
Dim stDocName As String
stDocName = "Client Profile"
stTEMPLATE = "C:Documents and SettingsBillApplication DataMicrosoftTemplatesclient_registration.oft"
stFilter = "IDNo = " & Me![IDNo]
DoCmd.OpenReport stDocName, acPreview, , stFilter
namer = InputBox("Who is this clent info being sent to?")
DoCmd.OutputTo acReport, stDocName, acFormatRTF, ("C:Documents and SettingsBillMy DocumentsHISRegistrations" & Me.IDNo & "_" & namer & ".txt")
DoCmd.SendObject acReport, stDocName, acFormatRTF
Exit Sub
MsgBox Err.Description
Resume Exit_Mail_Profile_Click
End Sub

View Replies View Related

Access E-Mail: DoCmd.SendObject Filters - Version: 2000 (9.0)

Greetings All.

I have a question regarding e-mailing a filtered report from Access 2000.

Does the "DoCmd.SendObject" command allow a filter? I have a report that I open filtered (to one record), and would like to e-mail the single-record filtered report using "DoCmd.SendObject", but have had no success.

Any pointers on how to do this would be greatly appreciated.

Thanks in advance,


Edited by: Bonifaceg on Tue Nov 15 3:02:36 EST 2005.

View Replies View Related

SendObject To More Than One Email Address

The code below works for the one email address "Quality Assurance"...but I want to add more email values to SendObject command.
If I do this: stEmail = Me.Quality_Assurance_Authorizer.Column(1) And Me.Engineering_Authorizer.Column(1)..... I get a Runtime error '13' Type mismatch. Is there another way of including a series of email values into the SendObject code below? The reason I'm using the value of the column is that sometimes the value may be null if that department doesnt need to be emailed. Thanks for any help.

Private Sub cmdPCAuthSend_Click()

Dim stDocName As String
Dim stEmail As String

stDocName = "rptPCAuthReq"
stEmail = Me.Quality_Assurance_Authorizer.Column(1)
DoCmd.SendObject acSendReport, stDocName, "SnapshotFormat(*.snp)", stEmail, , , "PCA Authorization Request", "Please review this product change and authorize when appropriate."

Exit Sub

End Sub

View Replies View Related

Pass Thru Query With DoCmd.SendObject AcSendQuery, "aaaaa", AcFormatXLS

With a pass thru query this doesn't work - somehow the file doesn't contain any data - can I get this to work with for a pass thru query.

(I have tried using a another query to SELECT * FROM Passthru but that has the same problem, all is fine when using a standard access query with no pass thru involvement)


View Replies View Related

SendObject Edit Email - Version: 2003 (11.0)

I have used the DoCmd.SendObject to send confirmation emails with Access97, Access2000. However regardess of the option to Edit (False or True) the email waits for confirmation to send.
Using Access XP and/or Access 2003, using YahooMail, using WindowsXP professional.
Any way to automate the batch process without viewing, sending each email.
Have found no references on KnowledgeBase or this forum.
Many thanks

View Replies View Related

SendObject - Suppress Yes/No Email Prompt - Version: 2007 (12.0)

I am using a sendobject method to send an email (w/ attachment) automatically via Outlook. How do I suppress the Yes/No prompt? It says something like "Another program wants to send an email on your behalf..."

View Replies View Related

SendObject Macro Email Template? - Version: 2000 (9.0)

Is it possible to use the SendObject macro but for a standard email template to be used?
So a set Paragraph of text is already inserted within the Email message?


View Replies View Related

Providing A Different Name For Email Attachment In Sendobject - Version: 2007 (12.0)

When using SendObject is there a way of specifiying the detination name of the Report/Form to differ from the Report/form name?

I have a Report "Quotation" which is the name the attachement appears as in the email.. However It would be nice to change the name to include a sales reference number or Customer Name etc so when it comes back you can locate the right customer Quote without having to open each one...... and/or saving them to file (renaming in the process)

Thoughts/ Suggestions please.

Edited by: itdataservices on Sat Jan 5 17:22:35 EST 2008.

View Replies View Related

Export Data Using Sendobject From Macro To Email As Zipped - Version: 2003 (11.0)

Hi There

I am fairly new at this stuf.

Question : I have a DB that does some auto e-mails using the "Sendobject" function in the macros this works fine as it exports the data as Excel.

Is there anyway to ZIP the file before it exports to outlook ?

The file is 11 MB and does not pass the mail server once zipped manualy the file is 2 MB

Big thanks

View Replies View Related

Email Snapshot File From Outlook (replaces SendObject). - Version: 2002 (10.0) XP

The following code illustrates how to output and attach a report as a snapshot viewer file to an Outlook Email.

This code can be used to replace the SendObject command (if you are using Outlook as your mail client).

Please make sure to add the Microsoft Outlook Object Library to your References.
Code:Function EmailSnpFile()

Dim olApp As Outlook.Application
Dim objMail As Outlook.MailItem
Set olApp = Outlook.Application
Dim strPath As String

'Output Report as Snapshot file
strPath = CurrentProject.Path
DoCmd.OutputTo acOutputReport, "Your Report Name", acFormatSNP, strPath & "Report.snp"

'Create e-mail item
Set objMail = olApp.CreateItem(olMailItem)

With objMail
.To = ""
.Subject = "Your Subject"
.BodyFormat = olFormatHTML
.HTMLBody = "<HTML><BODY>" & "Your Email Body" & "</BODY></HTML>"
.Attachments.Add strPath & "Report.snp"
End With

End Function

View Replies View Related

How To Insert Carriage Return In Email Body Using SendObject - Version: 2000 (9.0)


I have an After Update function in a combobox that creates an Outlook email message based on values in form controls. In the email that is created, I simply want to add a carriage return so that the value in the field in green text below starts on a new line rather than immediately after the "...following details:" text. Any help on how to do this is greatly appreciated.


Private Sub cboStaffName_AfterUpdate()
On Error GoTo next1
'DoCmd.SetWarnings False
DoCmd.SendObject , "", "", "[EarlyWarningEmail,tblEarlyWarningEmail]", "", "", _
"Diarized Corporate Action Expiring within 6 weeks for " & Me.txtPropertyName, _
"A diarized Corporate Action on " & _
Me.txtPropertyName & " (Security Number: " & Me.txtPropertyNumber & ")" & _
"will be expiring within the next 6 weeks. Please set-up a CCA as per the " & _
"following details: " & Me.txtComments

Exit Sub
End Sub

View Replies View Related

Outlook Email Generated By Sendobject - Send Button Not Working - Version: 2000 (9.0)

I have an Access VBA program that uses sendobjects to generate a new email and address it.

This works fine on my computer, but on another computer the outlook messages send button is greyed out and won't work. When I copy and paste the email addresses to another email, it works fine.

Any ideas on why this may be happening ?

View Replies View Related

SendObject And Multiple Snapshots - Version: 2003 (11.0)

I have two reports (snapshots) that I need to send, by email, at the same time using one command button. Currently I'm using the SendObject macro to email one report. I tried separating the two file names using a semi-colon in the Object Name field but it read it as one file that it could not locate. Is there away to specify an additional snapshot report that would enable me to do this?


View Replies View Related


I have created a macro to email a report it works fine on my computer, but when user at another computer tries it they get the following message:


Any suggestions?

View Replies View Related

Multiple DoCmd's

Is is proper technique to have multiple DoCmd's assigned to one action.

For instance:


DoCmd. etc.

These are just examples not intended to be proper syntax etc. Just trying to figure out the proper way to do something like this.



View Replies View Related

SendObject To Multiple Recipients Malfunctioning - Version: 2002 (10.0) XP

After code to set variables for recipient, CC, subject, body text, etc., I have this line of code in the ON CLICK event of a form button. It has always worked flawlessly.

Code:'Insert the e-mail message into the body of the note and wait for the engineer to click SEND.
DoCmd.SendObject acSendNoObject, , , strRecip, strCC, , strSubjLine, strEmailMsg, True

We started noticing a few days ago that this has stopped working properly. It will no longer send to multiple recipients. Upon debugging, I find that strCC = "EMAIL1; EMAIL2; EMAIL3" (names changed to protect the innocent ). In the past, my Novel GroupWise 6.5 would fire up, and the CC field would have the three recipients. Now it just has the last one... and only one. I have checked other MDBs that use the SendObject method and they, too, now only send to the last recipient in the list only.

Does anyone have a clue why Access would suddenly start behaving this way? Are there other delimiters I can use to try to "wake it up"? I have tried commas, but no luck... still only the last person.

View Replies View Related

Copyrights 2005-15, All rights reserved