email excel attachment (1 Viewer)

David b

Registered User.
Local time
Today, 13:33
Joined
Mar 2, 2003
Messages
102
I am trying to email to a selected customer some data as an excel attachment.

The following routine creates the email and attachment but the address needs to be added manually.

The address is grabbed by this sql -
SELECT Customers.CustomerID, Customers.EmailAddress
FROM Customers
WHERE (((Customers.CustomerID)=[Forms]![Customersfrm]![CustomerID]) AND ((Customers.EmailAddress) Is Not Null));

How do I incorporate the address grabber in the function ?

TIA
David b

Function send_barcodes()
On Error GoTo send_barcodes_Err

DoCmd.SendObject acQuery, "findbarcode", "MicrosoftExcel(*.xls)", "", "", "", "Northumbrian Pedigree Bar Codes", "Enclosed as promised", False, ""


send_barcodes_Exit:
Exit Function

send_barcodes_Err:
MsgBox Error$
Resume send_barcodes_Exit

End Function
 

Friday

Registered User.
Local time
Today, 13:33
Joined
Apr 11, 2003
Messages
542
If there is only one customer each time you run this, why not grab it(the email address) off the form and incorporate it into the function?
 

David b

Registered User.
Local time
Today, 13:33
Joined
Mar 2, 2003
Messages
102
Thanks for the reply. That should work.
 

Users who are viewing this thread

Top Bottom