473,471 Members | 4,687 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Send Email and Attach

135 New Member
I have a database that I’ve created for creating/printing/sending purchase orders. It works great! Long live Access! Although, I have a slight problem with the sending part. I have a table for my suppliers that I pull some of the fields from to include in my main form for creating the purchase order. One of the fields is an email field that I have set as a hyperlink. If I click it and there is an email address in it then a new outlook email message will open, perfect. Here is the problem: I want to include as an attachment a pdf version of the purchase order. I have code that works great to output to a pdf. I have tried leaving the email field as a text field and then setting the onclick event to do a SendObject using the email address that is in the email field. It works nice and creates a message with the attached pdf. However, it only works as long as I have an address in my email field. If I click on the email field while it is blank I get an error. Even if the email field is blank I would then like to see a message open with the pdf attached and the address left blank. I could use a button instead, but I still get the error message if my email field is left blank. I hope this makes some sense. I just want to send a message with an attachment and include the address if there is one. Thanks in advance.
Expand|Select|Wrap|Line Numbers
  1. DoCmd.SendObjectacReport,"PurchaseOrder", acFormatPDF, Me.email , , , "Purchase Order", "The content of this email is the confidential property of the ####### and should not be copied, modified, retransmitted, or used for any purpose except with the #######'s written authorization.  If you are not the intended recipient, please delete all copies and notify us immediately. "
  2.  
  3.  
  4.  
Oct 18 '09 #1

✓ answered by MyWaterloo

Praise God! It's amazing how many times I find my own solutions after I post. Thanks anyway. ...and it was such an easy fix... ;-)
Expand|Select|Wrap|Line Numbers
  1.  If IsNull([email]) Then
  2.  
  3. DoCmd.SendObject acReport, "PurchaseOrder", acFormatPDF, , , , "Purchase Order", "The content of this email is the confidential property of ###### and should not be copied, modified, retransmitted, or used for any purpose except with ######'s written authorization.  If you are not the intended recipient, please delete all copies and notify us immediately. "
  4. Else
  5. DoCmd.SendObject acReport, "PurchaseOrder", acFormatPDF, Me.Email, , , "Purchase Order", "The content of this email is the confidential property of ###### and should not be copied, modified, retransmitted, or used for any purpose except with ######'s written authorization.  If you are not the intended recipient, please delete all copies and notify us immediately. "
  6.  
  7. End If 

2 2599
MyWaterloo
135 New Member
Praise God! It's amazing how many times I find my own solutions after I post. Thanks anyway. ...and it was such an easy fix... ;-)
Expand|Select|Wrap|Line Numbers
  1.  If IsNull([email]) Then
  2.  
  3. DoCmd.SendObject acReport, "PurchaseOrder", acFormatPDF, , , , "Purchase Order", "The content of this email is the confidential property of ###### and should not be copied, modified, retransmitted, or used for any purpose except with ######'s written authorization.  If you are not the intended recipient, please delete all copies and notify us immediately. "
  4. Else
  5. DoCmd.SendObject acReport, "PurchaseOrder", acFormatPDF, Me.Email, , , "Purchase Order", "The content of this email is the confidential property of ###### and should not be copied, modified, retransmitted, or used for any purpose except with ######'s written authorization.  If you are not the intended recipient, please delete all copies and notify us immediately. "
  6.  
  7. End If 
Oct 18 '09 #2
NeoPa
32,556 Recognized Expert Moderator MVP
That's pretty well what I had to do in my print routine for reports. Unfortunately, as an omitted parameter is passed through as the Missing flag in a Variant variable, there is no way to specify this in code (that I know at least).
Oct 18 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

40
by: ian | last post by:
Hi, I'm a newbie (oh no I can here you say.... another one...) How can I get Python to send emails using the default windows email client (eg outlook express)? I thought I could just do the...
3
by: Lenard Lindstrom | last post by:
Posted in a previous thread was some Python code for accessing Window's Simple MAPI api using the ctypes module. http://groups-beta.google.com/group/comp.lang.python/msg/56fa74cdba9b7be9 This...
4
by: tp | last post by:
HI... I have created simple .asp page and i would like to send my page as email using my outlook . is it possible to send form body as new email outlook body using mailto command or any other...
1
by: Jeff West | last post by:
Greetings all, I'm not a developer (not even close) but have been teaching myself Access lately and would like to ask the group for some help. I've recently created a employee contact database...
6
by: a | last post by:
What is the best way to construct an email in python and also attach a html file the html file to be attached is not on disk, but should be dynamically constructed in the python script I want...
2
by: oyster | last post by:
I find that the existing email moudle is some hard for me to understand, especially the part of how to set the CC, BCC and attach the files. Is there any more easy one like this p-code? import...
3
by: =?Utf-8?B?SHVnaA==?= | last post by:
Hi There, I use follow code to send email inside VB.NET 2005. It does not work well. Error message of "Failure sending email" would occue. However, email was sent out sometimes. I am confused...
1
by: shil | last post by:
Hi, I'm using FW 2.0 to send an email with an attachment using System.Net.Mail class. If I try to attach a file from my file system, I could successfully send the eamil. But I need to generate a...
11
by: pixie | last post by:
Hi, Access 2003. I have a DB that contains deadlines data. I have the DB set up to create a report for each person that has deadline within a certain time frame. I need to automate the DB so an...
1
by: sxwend | last post by:
I am trying to use the following post results (http://www.thescripts.com/forum/thread189759.html) and add another requirement. I need to send the results to just the email addresses that the query...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
Oralloy
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,...
0
jinu1996
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.