Solved

Auto-Fill email address in "Send" Access 97

Posted on 2013-05-30
3
660 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
  • 2
3 Comments
 
LVL 84

Assisted Solution

by:Scott McDaniel (Microsoft Access MVP - EE MVE )
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 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 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

840 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