Change Name of Spreadsheet when using DoCmd.SendObject

B

BillyRogers

I have an Access program that we use to email reports out to clients. I have
the date of the report in subject line of the email, but the spreadsheet that
is emailed is automatically given the name of the query. I'd like to add the
month and year to the name of the spreadsheet, because customers often get
confused about which month's report they are looking at. I don't see anyway
to do this using DoCmd.SendObject. Does anyone have any ideas?

Do I have to rewrite this using a reference to outlook? I can't rename the
query.

DoCmd.SendObject acQuery, "AgentDetailReport", "MicrosoftExcel(*.xls)",
Address, Copy, Blind, Subj1 & "-" & txtMonthEnd.Value, "", True, ""

Syntax

DoCmd.SendObject [objecttype][, objectname][, outputformat][, to][, cc][,
bcc][, subject][, messagetext][, editmessage][, templatefile]

--
Billy Rogers

Dallas,TX

Currently Using Office 2000 and Office 2003
 
A

Alex Dybenko

Hi,
I think the simple way - is to make one more query and name it the way you
like:

Dim qryd As QueryDef
Set qryd = CurrentDb.CreateQueryDef("AgentDetailReport0609", "Select * from
AgentDetailReport")

then send this query, and delete it after all


--
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com
 
Top