[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Auto-Fill email address in "Send" Access 97

Posted on 2013-05-30
3
Medium Priority
?
686 Views
Last Modified: 2013-05-31
In the File Menu, the Send item allows me to select which format I want to export the Report in, and then opens the email to send it. I need to auto-fill the To: field with the recipient's email address, which is saved in the account in Access 97. How can I accomplish this without having to manually enter each account's email address in the To field?
0
Comment
Question by:Moshe Singer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 85

Assisted Solution

by:Scott McDaniel (Microsoft Access MVP - EE MVE )
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 2000 total points
ID: 39209315
You can't do that with the builtin menuitems. You'd need to build a routine that would manage this.

You can use DoCmd.SendObject to create an email, and in that you can set the various elements of the email. For example:

DoCmd.SendObject acSendReport, "YourReportName", , "To", , , "Subject", "Message", True

This would create an email and display it to you. Depending on how your report is formatted, you might find this to be somewhat messy (Access doesn't do a good job formatting things like this for email use).

If you need to dynamically fill the "To" section, you can use DLookup for that, assuming you have some way to determine what to look up. For example, if I have an Employees table, and I know the ID of the Employee I want, I'd do this:

Dim sEmail As String

sEmail = DLookup("EmailField", "Employees", "ID=" & Me.ID)

My variable "sEmail" would contain the value retrieved from that table, and I could use it in my SendObject call:

DoCmd.SendObject acSendReport, "YourReportName", , sEmail, , , "Subject", "Message", True

Note that you can change the LAST argument to "False" to automatically send the message.
0
 

Author Comment

by:Moshe Singer
ID: 39209766
Thank you for your reply. However, there is one thing that is still unclear to me. When I use the "Send" menu item, it gives me the option to convert the open report to any of the 4 formats - HTML, Text, Excel, or RTF format.Then it opens Outlook Express and attaches the converted Report to the email.
How can I add to the Code, that it should convert the Report to any format for exporting?
Thanks loads for your previous solution and for your forthcoming help.
0
 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 2000 total points
ID: 39210269
You can define the format in the SendObject call in the 3rd argument:

DoCmd.SendObject acSendReport, "YourReportName", acFormatXLS , "To", , , "Subject", "Message", True

Be aware of this also:

"the only controls that are included in the object are text boxes (for .xls files), or text boxes and labels (for .rtf, .txt, and .html files). All other controls are ignored. "

From here: http://msdn.microsoft.com/en-us/library/office/ff197046(v=office.14).aspx

I realize that's from a much newer version, but the same caveats apply. The helpfile included with 97 should show you the valid values you can use for that argument.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question