How do I send report to Specific address?

johnbowser11

Registered User.
Local time
Today, 23:18
Joined
Apr 26, 2005
Messages
13
Hi everyone, an easy one probably for most of you no doubt.
below is the code for my button which attatches the report to an email as HTML, what I want it to do is fill in the address field too, with say access@programmers.co.uk so the user can just send the report straight out to the dept its needed.

Private Sub email_Click()
On Error GoTo Err_email_Click

Dim stDocName As String

stDocName = "DeliveryNoteReport"
DoCmd.SendObject acReport, stDocName, "HTML"

Exit_email_Click:
Exit Sub

any ideas?
 
Well you've gotten yourself halfway there...

From VisualBasic Help on SendObject:
DoCmd.SendObject [objecttype][, objectname][, outputformat][, to][, cc][, bcc][, subject][, messagetext][, editmessage][, templatefile]

So you've defined the type, the name and the format but each subsequent comma will take you to your next argument and the very next one is 'To'

So, in your form create a control with the address field (txtToAdr) pass that to your function like this:

Code:
DoCmd.SendObject acReport, stDocName, acFormatHTML, Me.txtToAdr

And you should be good. Pay attention to the slight change in 'format' too.

Regards,
~Chad
 

Users who are viewing this thread

Back
Top Bottom