May 1, 2005 at 2:43 am
Each month I make a file, with [Ship To], [Ship From] [Number of shipments], [Date of Shipment], [Weight], [Charge].
I send this information to different people using the country [Ship to] they are in charge of and the month they want the information for. So for example I send everything related to Belgium for April 2004 to Mr X, Holland for March 2005 to Mr Y.
How do I choose the country and the month a person wants and send it to the person in charge of that country?
If anyone can help with this query I will be very grateful.
May 2, 2005 at 5:44 am
"How do I choose the country and the month a person wants and send it to the person in charge of that country?"
Create another table "ShippingRequest" with "ShipTo", "ShipFrom" and "ShipMonth".
Change your query to join with this new table.
...ShippingRequest SR on x.ShipFrom = SR.ShipTo
May 3, 2005 at 1:30 am
I presume you have a table linking ShipTo, Person and EmailAddress - tRecipients.
It is then a simple matter to open this table in code and to step through it selecting the data you want and using sendobject to send the e-mail. I would assume that you have a suitable report defined - rCountry.
rs.Open "tRecipients", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
DoCmd.OpenReport "rCountry", acViewDesign, , , acHidden
Do While Not rs.EOF
Reports.rst.Filter = "ShipTo='" & rs("ShipTo") & "' AND [Date of Shipment] between " & StartDate & _
DoCmd.SendObject acSendReport, "rCountry", acFormatRTF, rs("EmailAddress "), , , _
"Shipping Report", "The attached is the shipping data for " & Format(StartDate,"mmmm yyyy"), __
rs.MoveNext
Loop
DoCmd.Close acReport, "rCountry", acSaveNo
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply