Hi All
At present I have a tblData, a tblPeople, a long union query and a report that displays its results. On a form I select a person from tblPeople (another field on that table contains their email address), run the query and report in that person's respect and email the results to them.
What I want to do is add a button which runs some VBA code which cycles through tblPeople, runs the query for each person, works out if the query has returned any records from tblData for that person, and if so - sends them the report.
I would be very grateful for some views on the easiest way to accomplish this, before I embark on my usual run of trial - error - error - error - ask for help. It's the cycling through tblPeople and running the query for each record, then checking if the query has returned a result which I really need the most help with. I think I can probably handle the DoCmd.SendObject stuff.
Thanks in advance!
Edit: I am using Access 2010
At present I have a tblData, a tblPeople, a long union query and a report that displays its results. On a form I select a person from tblPeople (another field on that table contains their email address), run the query and report in that person's respect and email the results to them.
What I want to do is add a button which runs some VBA code which cycles through tblPeople, runs the query for each person, works out if the query has returned any records from tblData for that person, and if so - sends them the report.
I would be very grateful for some views on the easiest way to accomplish this, before I embark on my usual run of trial - error - error - error - ask for help. It's the cycling through tblPeople and running the query for each record, then checking if the query has returned a result which I really need the most help with. I think I can probably handle the DoCmd.SendObject stuff.
Thanks in advance!
Edit: I am using Access 2010