Email a Report

N

Nigel

I have a table containing names, addesses, email, etc of my customers
(tblCustomers). When I create a report based upon their order(rptCustOrder),
I want to be able to email it to them. I know I can use the SendObject when I
create a macro, but is there a way to select who I send the email to, rather
than having to write the address manually.

Thanks

Nigel
 
W

witharebelyell

'You might have to write some VB code, and the call the function ,
' from a 'runcode' action from your macro
'eg.


Function sendreport()
Dim semail As String
semail = DLookup("email", "tblCustomer", "customerid = " & Forms!
Myform!customerid & "")

DoCmd.SendObject acSendReport, "myreport", acFormatRTF, semail, ,
"test", , False

End Function

' This is a bit of a hack way for this to work. The query
' that your report is based on should also reference the field on the
form
' Forms!Myform!customerid in its criteria, i assume you are running
the report from a form?

' note the sendobject sometimes dosen't send the email
automatically , even if you
' say edit = false, it depends on your sites mail client. If this is
the case you
' might have to call the email client library via more code (i have
code for this if your
' using lotus notes).

' i hope this helps

'mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top