Solved

Auto-Fill email address in "Send" Access 97

Posted on 2013-05-30
3
625 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now