Emailing a specific report!

Enviva

Registered User.
Local time
Today, 15:18
Joined
Sep 24, 2005
Messages
37
Hi All,
I have a form that opens with a specific record. I have 2-buttons, one to [Print], the other to . I can get the [Print] button to print the selected record, and the [email] will email the single report as long as the report window is open. But if the user closes the report window and then selects to email, it will email the report (of ALL RECORDS).

I am currently using:

Private Sub cmdEmail_Click()
On Error GoTo cmdEmail_Click_Err
strEmail = DLookup("EmailAddress", "reportQuery", "[tblDrugScreen.DSID] = " & Me![DSID])
If IsNull(strEmail) Then
MsgBox "Company has NO Email Address"
Exit Sub
End If
DoCmd.SendObject acReport, "DSReport", "SnapshotFormat(*.snp)", [strEmail], "", "", "D/S Results", "", , ""

cmdEmail_Click_Exit:
Exit Sub

cmdEmail_Click_Err:
MsgBox Error$
Resume cmdEmail_Click_Exit

End Sub

Is there a way I can email the specific report where:"[tblDrugScreen.DSID] = " & Me![DSID], so that the report window does not have to be open?

Thank for your help.....Enviva
 
It is acheived through your query that drives the report.

In the criteria for the field DSID, type

[Forms]![YourFormName]![DSID]
 
Thanks Kempes....that worked!!
 

Users who are viewing this thread

Back
Top Bottom