473,385 Members | 1,292 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Button to send an email that includes specified objects

4
I have created an Access form that I use when making phone calls. The form is based on a table, (called Customer Name), and also contains a subform based on a table (called Purchases). The form includes the contact name, phone number (data that comes from the Customer Name table). It also includes business name (data that comes from the Purchases Table) and a memo field (in the subform) to take notes in while making the phone call.

1. I would like to add a button that sends an email that includes several fields from the form and subform in the body of the email. 2. The receipient of the email would come from a third table that is linked by relationship. 3. I would like the subject line of the email to read: "Customer Follow-up Call".
Is this possible? I would be thankful for any pointers, as I have been trying to figure this out for quite some time.
Jan 21 '07 #1
2 1074
MMcCarthy
14,534 Expert Mod 8TB
I have created an Access form that I use when making phone calls. The form is based on a table, (called Customer Name), and also contains a subform based on a table (called Purchases). The form includes the contact name, phone number (data that comes from the Customer Name table). It also includes business name (data that comes from the Purchases Table) and a memo field (in the subform) to take notes in while making the phone call.

1. I would like to add a button that sends an email that includes several fields from the form and subform in the body of the email. 2. The receipient of the email would come from a third table that is linked by relationship. 3. I would like the subject line of the email to read: "Customer Follow-up Call".
Is this possible? I would be thankful for any pointers, as I have been trying to figure this out for quite some time.

This is the code that you would need. I am using commandBtn in place of whatever your command button name is. Also I've used UserID for the relationship to the table containing the email address as I don't know what the relationship is.

Expand|Select|Wrap|Line Numbers
  1. Private Sub commandBtn_Click()
  2. Dim strRecipients As String
  3. Dim strSubject As String
  4. Dim strBody As String
  5.  
  6.    strSubject = "The subject"
  7.    strBody = Me.Field1 & " " & Me.Field2 ' or something long these lines
  8.  
  9.    strRecipients = DLookup("[EmailAddress]","TableName","[UserID]=" & Me.UserID)
  10.  
  11.    DoCmd.SendObject acSendNoObject, , , strRecipients, , , strSubject, strBody
  12.  
  13. End Sub
  14.  
Check out this thread for the full syntax of this function:

http://www.thescripts.com/forum/thread561826.html
Jan 23 '07 #2
Jenn
4
Thank you. I will give this a try. I appreciate your response. Thanks for your time.

This is the code that you would need. I am using commandBtn in place of whatever your command button name is. Also I've used UserID for the relationship to the table containing the email address as I don't know what the relationship is.

Expand|Select|Wrap|Line Numbers
  1. Private Sub commandBtn_Click()
  2. Dim strRecipients As String
  3. Dim strSubject As String
  4. Dim strBody As String
  5.  
  6.    strSubject = "The subject"
  7.    strBody = Me.Field1 & " " & Me.Field2 ' or something long these lines
  8.  
  9.    strRecipients = DLookup("[EmailAddress]","TableName","[UserID]=" & Me.UserID)
  10.  
  11.    DoCmd.SendObject acSendNoObject, , , strRecipients, , , strSubject, strBody
  12.  
  13. End Sub
  14.  
Check out this thread for the full syntax of this function:

http://www.thescripts.com/forum/thread561826.html
Jan 27 '07 #3

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

Similar topics

9
by: Melissa | last post by:
What is the code to delete a command button from a form? Can the code be run from the click event of the button to be deleted? Thanks! Melissa
7
by: Miguel Dias Moura | last post by:
Hello, I am working in ASP.net / VB with Access Database. i have a Multipage in my web site with the Submit button as the last button. When the Submit button is pressed i want the form...
2
by: m_evergreen | last post by:
Errors: An unhandled exception of type 'System.Web.HttpException' occurred in system.web.dll Additional information: Could not access 'CDO.Message' object. innerexception is "Exception has...
11
by: fdu.xiaojf | last post by:
Hi, I just want to send a very simple email from within python. I think the standard module of smtpd in python can do this, but I haven't found documents about how to use it after googleing....
6
by: rongchaua | last post by:
Hi all, I want to change the style of a button. But I don't know how to do it. For example, I have already a button OK on form. I want to add these styles to this button (WS_CHILD || WS_VISIBLE ||...
2
by: thanos | last post by:
Hello, How do i pass the value of the radio button to be put of the action that includes the value as part of the URL being submitted - "/ picked.php?pick_num=". Any help with be appreciated. ...
2
by: HyBry | last post by:
I am quite new to this and my VB knowledge is close to zero. I have created a for that shows info about applications and it includes a subform with all the people responsible for the application....
12
by: forrestgump | last post by:
I am currently trying to create VBA to send a specified excel sheet to varied email sources. I currently have the code below which sends the attachment in an email to a specified source e.g....
4
by: Ken Fine | last post by:
I'm making an administrative interface that lists records in a GridView. For *each* row in the gridview, I would there to be two interface elements in addition to some information associated with...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.