?
Solved

Auto-Fill email address in "Send" Access 97

Posted on 2013-05-30
3
Medium Priority
?
681 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Suggested Courses

766 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