Email report based on current record.

Coatezy

Registered User.
Local time
Yesterday, 16:47
Joined
Jan 8, 2009
Messages
39
Hi,

I am trying to email a report based on the current record being viewed in a form. I have this so far but of course when the report is created it has all the records in it. Was wondering how I can create a report for the current record in the form.

DoCmd.SendObject acSendReport, "rptEmailDetails", acFormatPDF, Me.EmailAddress_tblTPAgents, , , Me.Title & " " & Me.Surname & " - " & Me.Reference, "Message here"

Im sure this is stupidly easy but I just can’t get my head round it :o
 
I think you would have to set your "rptEmailDetails" To have a where clause in the actual report. Then you would set it with a unique ID field.

When the report loads it will look at the table's Record ID (or whatever name you gave it) and only display the record that is currently on the form. so.. something like

Where [table_Name].[UniqueID] = [FormName].[UniqueID]

Mind you, wih doing this the report will never stand alone. If you try to open the report by itself it will look for the required value from the form.

Hope that helps
 
What I've done is made queries, filtered out what I don't want to see and created a report. However, if you were to make several different reports, you would have to create just as many queries that correlates with each report. It may be inefficient and doesn't involve any VBA, but it works for me.
 

Users who are viewing this thread

Back
Top Bottom