I've created a form for use by our employees. I have it simple as possible with a New Record, Save Record, and Email command buttons.
The email command is set up to mail a specific query that I have created. Everything works properly, but when you click to email a command pops up to select my format, and then opens microsoft office to have me type in the email addresses. - Private Sub MAIL_Click()
-
On Error GoTo Err_MAIL_Click
-
-
Dim stDocName As String
-
-
stDocName = "PURCHASE ORDER Query"
-
DoCmd.SendObject acReport, stDocName
-
-
Exit_MAIL_Click:
-
Exit Sub
-
-
Err_MAIL_Click:
-
MsgBox Err.Description
-
Resume Exit_MAIL_Click
-
-
End Sub
That is the default code for email. What needs to be done so that when I click the email command it selects the format and sends to predetermined addresses automatically?
I am an Access novice, so any help would be greatly appreciated.
4 1618 ADezii 8,834
Recognized Expert Expert
Use the Full Syntax of SendObject(), while stating the Output Format, as in either one of the five examples below: - DoCmd.SendObject acSendReport, stDocName, acFormatDAP, "<Some E-Mail Address>", , , "<Subject of E-Mail>", "<E-Mail Message>", False
-
DoCmd.SendObject acSendReport, stDocName, acFormatHTML, "<Some E-Mail Address>", , , "<Subject of E-Mail>", "<E-Mail Message>", False
-
DoCmd.SendObject acSendReport, stDocName, acFormatRTF, "<Some E-Mail Address>", , , "<Subject of E-Mail>", "<E-Mail Message>", False
-
DoCmd.SendObject acSendReport, stDocName, acFormatTXT, "<Some E-Mail Address>", , , "<Subject of E-Mail>", "<E-Mail Message>", False
-
DoCmd.SendObject acSendReport, stDocName, acFormatXLS, "<Some E-Mail Address>", , , "<Subject of E-Mail>", "<E-Mail Message>", False
Thanks, that works great now. Is there a way I can add that code to the command button I have to close the application, so that it will email the file and close when finished?
Nevermind on the last post. I moved my DoCmd.Quit up a few lines and works perfectly now. Thanks for the help ADezzi.
ADezii 8,834
Recognized Expert Expert
If you wish to add the Code when you Close the Application, you should probably place it in the Close() Event of your Main Form: - Private Sub Form_Close()
-
DoCmd.SendObject acSendReport, stDocName, "<Format>", "<Some E-Mail Address>", , , "<Subject of E-Mail>", "<E-Mail Message>", False
-
End Sub
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: coder_1024 |
last post by:
I'm trying to send a packet of binary data to a UDP server. If I send
a text string, it works fine. If I attempt to send binary data, it
sends a UDP packet with 0 bytes of data (just the...
|
by: praba kar |
last post by:
Dear All,
I have doubt regarding mail sending smtplib
module. The below code is I used to send a mail.
##########################################
import email.Message
import email.Utils...
|
by: Robert A. van Ginkel |
last post by:
Hello Fellow Developer,
I use the System.Net.Sockets to send/receive data (no
tcpclient/tcplistener), I made a receivethread in my wrapper, the
receivethread loops/sleeps while waiting for data...
|
by: yaron |
last post by:
Hi,
I have a problem when sending data over TCP socket from c# client to java
server.
the connection established ok, but i can't send data from c# client to java
server.
it's work ok with...
|
by: Ant |
last post by:
Hi, I'm using the MailMessage & smtpMail classes in System.Web.Mail to send
mail, however it's not sending any emails.
I'm using it on a Windows 2003 server.
The simplest way to use this is...
| |
by: Sydney |
last post by:
Hi,
I am trying to construct a WSE 2.0 security SOAP request in VBScript on an
HTML page to send off to a webservice. I think I've almost got it but I'm
having an issue generating the nonce...
|
by: remya1000 |
last post by:
by using FTP i can send files to server using vb.net.
if the file is big, then it will take some time to complete the sending process to server.or if we were sending 3-4 files to the server one by...
|
by: JoeP |
last post by:
Hi All,
How can I find the reason for such an error: Failure sending mail.
Some Code...
oMailMessage.IsBodyHtml = False
oMailMessage.Body = cEmailBody
Dim oSMTP As New SmtpClient...
|
by: =?Utf-8?B?R3V5IENvaGVu?= |
last post by:
Hi all
I use:
Dim message As New MailMessage(txtTo.Text, txtFrom.Text, txtSubject.Text,
txtBody.Text)
Dim emailClient As New SmtpClient(txtSMTPServer.Text)
emailClient.Send(message)
And its...
|
by: Chocolade |
last post by:
Hi,
Im using System.Net.Mail to send email in my application it was working great without any problems untill this morning after like 20-30 tries it was sending the email ok then suddenly this...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |