View Full Version : SendObject > auto fill the "To" box


roydmercer
10-30-2003, 09:46 AM
I built a db that generates a report from a query, then attaches the report, via a macro>SendObject, to an Outlook e-mail message. Within the db is a table of names (email addressees) which the user selects to initiate the report via a listbox within a form. The selected name also appears within the report itself.

I wish to now auto-populate the "To" box in Outlook with the chosen name and have the message sent in background?

BTW > This is in Access 95, v7...my company is By Gawd cheap! Any help is most appreciated.

Hayley Baxter
10-30-2003, 12:34 PM
Your probably better using VBA to perform this task rather than a macro using the sendobject command. There are many email examples on this forum which you can download.

Mile-O
11-04-2003, 02:23 AM
In the To: section of the macro you may be able to set it to the listbox selection with an expression.


i.e. =[Forms]![MyForm]![MyListBox].[Column](1)

or something like that.

I don't know Access 95 though.

roydmercer
11-10-2003, 09:53 AM
Thanks to all for the help!!! While all suggestions would likely have worked, the last one was the short answer with a few caveats...1) Even at the command level Access apparently will not allow a name as a single record (last name, First name MI) and insert it into Outlook's To box as it instead believes the record to be a "list". 2) Access will thus see the "space" between first name and MI and place a semicolon there which is its default list separator. This action bombs any emails to those other than last name, first name addresses within Outlook. 3) As a work-around, I easily created the full internet email addresses in Excel and included those in a table > qry matching up with the general names. (Microsoft was at a loss to provide another decent/fast solution.) 4) As Outlook will perform an automatic name search at the Send command, it thus recognizes the recipient's full internet e-mail address and transmits the message. 5) One must be very careful with the Column number in the SendObject command's To reference; it must be exact for the correct recipient. Thanks again!!! :):)

gkrajenta
12-23-2003, 03:02 PM
I might be being stupid here, but what exactly is the value of "[column](1)"? I've tried the column heading, the coulmn number, both combined, different combinations of parenthesis and brackets, and every time I get the message "The database does not contation the Automation object:" whatever value I type.

Edit: I took a fresh look at it today and found the problem.