Unanswered: SendObject to all records in filtered form
Happy to have solved the problem of sending a mail from my default mail program by a click of a button to ONE contact.
(Simple Macro w/ SendObject, all fields empry but the "To" Field Where I simply put a =[email] expression. For anyone else who has the same problem I had before)
Strange, though, that Microsoft haven´t made a special mail mask or something from the start. Not a very unique need to want to be able to mail a contact with a simple click of a button.
However - I would like to extend this feature. I would like to create a macro that sends the same mail to ALL my contacts. Filtered form or nonfiltered form.
In other words to the [email]field in every record.
I figure I need to extend the "To"=[email] expression to some kind of:
[email] from rec 1, [email] from rec 2, [email] from rec 3....[email] from rec N - expression
with a semicolon in between every mail address so the mailprogram treats the mail-list right.
Does any helpful soul know the correct syntax for this expression? Can it be done?
Or do I have to set up some kind of loop, copy [email] from every record in to a field - say [MailContainer] and then set the SendObject "To" field to =[MailContainer].
Thanks for the hint. Now I know in what direction to trial and error. I have the logics of it all figured out. Simple loop, collect address, etc. Prob is I don´t know the syntax. Newbie to VBA, access etc.
Second prob is that I am in Thailand. They only have literature in Thai... I´ll learn that language too eventually. But that will probably take a lot longer .
Dim rs as RecordSet
Dim SendString as string
SendString = ""
Do Unti rs.EOF
SendString=SendString & rs(NameOfEMailAddressFieldFromQueryOrTable) & "; "
Set rs = Nothing
The mail will pop up in Outlook, with the address list from my contacts in the right place. Then I can just add the attachment, press send, and of it goes to everyone.
If you wanna automate it completely, send it off by the date and time function. You don´t seem as free to choose file. You can only chose objects inside access. Thereofore you could make a report and have that sent off by the clock. The first option in the sendobject cmd is Object Type(report, form, etc), the second is Object Name, the third is Output format (rtf, xls etcl?) and the fourth is the mails "to" field. Have a look at the cmd in macro mode.
However it does seem to be only for MAPI. Probably for Outlook in particular (if I know Microsoft...). But I have seen a lot of loooong codesnippets out there. Don´t know if there is any workarounds using the SendObject cmd specifically. But maybe some other command that acheives the same thing.
Thanks for your help. However I am not sure it is what I need. Maybe I have missunderstood. Doesn´t this exemple make the filtering parameters set once for all? Would I not get the same result if I made a query and set that as recordsource? I do not know exactly what the marketing people want to filter. Furthermore the form has about 40 different productinterest checkbuttons. I must let them do the filtering themselves in the form. Then just let them press send to shoot to whomever has shown up in their selections.
I figure I need a formloop instead. Not a recordsource loop. But don´t know how. Or otherways I need to export the current filtered form to a query or table and use that as recordset. Or even - use the query that Access makes itself when someone filters in a form. But I don´t know how to get that.