Use DoCmd.SendObject to Send an Excel .xls with Filename Based on an Order Number
Posted on 2008-10-01
I have an Access 2003 Db that uses DoCmd.SendObject to send a vendor an order based on a query called "Qry_Order". This works great, but it would be nice if the filename was unique to each order . As it is now, the attached .xls file is always named after the query so: "Qry_Order.xls".
There is an order number that I would like to pass to create the filename from. It is called "PR_Number" and looks like "PR1058", for example and this would, ideally be passed to create "PR1058.xls" I have no idea how to do this. I have a combo box I can reference for the PR_Number. Just don't know it it can be done.
Here is the DoCmd statement I have now:
DoCmd.SendObject acSendQuery, "Qry_Order", "Microsoft Excel", _
, , StrSubject