Or
Say you have a list box with
ID, 1stName, EmailAddress
Your list box is called MyListBox
You have a report that you can filter via a query and this report is call
MyReport
You have a form (MyForm) with a button (MyButton)
You have a text box on your form (MyTextBox)
You have another text box on your form (MyOtherTextBox)
You want to send out lots of MyReports to all the people in MyListBox
You want to personalise the reports
You want to personalize the title of the e mail
You want to add some text in the detail of the e mail
You want to send your admin office an email saying your so good at your job
you have sent all the reports
Public Sub MyButton _Click()
Dim varItem As Variant
'select all items on list box'
With Me. MyListBox
For lngX = Abs(.ColumnHeads) To (.ListCount - 1)
.Selected(lngX) = True
Next
End With
For Each varItem In Me. MyListBox.ItemsSelected
Me. MyTextBox = MyListBox.Column(1, varItem)
Me. MyOtherTextBox = MyListBox.Column(0, varItem)
'Copy report and rename it'
DoCmd.CopyObject , "Sale and Stuff" & " " & Format(Date, "short date") & "
for " & MyListBox.Column(1, varItem), acReport, "MyReport"
'set value to filter the report'
Me.MyOtherTextBox = Me.MyListBox.Column(0, varItem)
'open the new report'
DoCmd.OpenReport "Sale and Stuff" & " " & Format(Date, "short date") & " for
" & MyListBox.Column(2, varItem), acViewPreview, "",
"[ID]=[Forms]![MyForm]![MyOtherTextBox]", acHidden
'send the new report everyone'
DoCmd.SendObject acReport, "Sale and Stuff" & " " & Format(Date, "short
date") & " for " & MyListBox.Column(1, varItem) , "RichTextFormat(*.rtf)",
MyListBox (1, varItem), MyListBox.Column(2, varItem), "", "", False, ""
'close the new report'
DoCmd.Close acReport, "Sale and Stuff" & " " & Format(Date, "short date") &
" for " & MyListBox.Column(1, varItem),
'Deletes the new report - but leave the original template in place'
DoCmd.DeleteObject acReport, "Sale and Stuff" & " " & Format(Date, "short
date") & " for " & MyListBox.Column(1, varItem),
'go to next item on the list and do it again'
Next varItem
'send admin a note to say the reports have been done'
DoCmd.SendObject acSendNoObject, , , "Some E Mail (e-mail address removed) ", "",
"", "To Admin from Me ", "God I’m so good I have done the reports already.
The reports all went at " & Format(Now, "dd mmmm yyyy hh:nn AM/PM"), False, ""
'Open Outlook so the mails will send - you may need to change the path'
Call Shell("C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE")
End Sub
I have NOT checked this but it hould be OK - or something like that
--
Wayne
Trentino, Italia.
bgarey said:
I have a data base of entries with one field set up as E-mail addresses.
How can I tell the computer to collect all these addresses as a group and
send out one e-mail to the whole group?