J
johnnywinter via AccessMonster.com
I have been told I need to write code for “Looping a recordset†but I am
confused where to start..
I want to replace having to manually input different variables for the same
field [REP] 30- 40 times and run the same query 30-40 times to run the same
report for each salesperson [REP] and to send 30-40 different emails.
I have a query “BYREP†that uses two tables, linked by the field [REP]
Table 1 “CASH COLLECTIONS†(each record is one cash receipt)
Table 2 “REPMASTER†(one record for each salesperson )
Here is what I do manually- 30-40 times and input the value for [REP] each
time:
1) RUN Query name: “BYREP- which query contains:
all fields from table “CASH COLLECTIONSâ€
and 3 fields from table “REPMASTERâ€
field [REP]
field: [repName]
field: [repEmailAddress]
2) OPEN REPORT "CURRENT MONTH CASH COLLECTIONS BY REPâ€- as a pdf file
I use Cute Pdf Creator to print (save) this as a pdf file.
All PDF files are saved in same directory: “c:/Current Month
Collections/[REP] cash
collections.pdfâ€
(each different pdf file is named with the value of the field [Rep]
used in each diff query)
3) Email each salesperson [REP] to the email address in the field
[repEmailAddress]
and attach the applicable pdf file that matches that [REP].
NOTE: I can use reports saved as Access Snapshot files rather than pdf files
if necessary,
confused where to start..
I want to replace having to manually input different variables for the same
field [REP] 30- 40 times and run the same query 30-40 times to run the same
report for each salesperson [REP] and to send 30-40 different emails.
I have a query “BYREP†that uses two tables, linked by the field [REP]
Table 1 “CASH COLLECTIONS†(each record is one cash receipt)
Table 2 “REPMASTER†(one record for each salesperson )
Here is what I do manually- 30-40 times and input the value for [REP] each
time:
1) RUN Query name: “BYREP- which query contains:
all fields from table “CASH COLLECTIONSâ€
and 3 fields from table “REPMASTERâ€
field [REP]
field: [repName]
field: [repEmailAddress]
2) OPEN REPORT "CURRENT MONTH CASH COLLECTIONS BY REPâ€- as a pdf file
I use Cute Pdf Creator to print (save) this as a pdf file.
All PDF files are saved in same directory: “c:/Current Month
Collections/[REP] cash
collections.pdfâ€
(each different pdf file is named with the value of the field [Rep]
used in each diff query)
3) Email each salesperson [REP] to the email address in the field
[repEmailAddress]
and attach the applicable pdf file that matches that [REP].
NOTE: I can use reports saved as Access Snapshot files rather than pdf files
if necessary,