B
beavetoots
For each employee in a table, I want to pull the transactions for that
employee, put the transactions into a report,
then email the file to the employee
for example:
emptable contains employee number and email address
empnum
email
transtable contains transactions and employee number for each transaction
empnum
transtype
amount
I've been trying to do this in a loop, but it outputs all employees to a
report. I don't know how to code this so that it would go through
the emptable one by one to do this.
Function Macro2()
Dim BegCt As Integer
Dim MaxCt As Integer
BegCt = 1
MaxCt = DCount("*", "emptable")
If BegCt <= MaxCt Then
Do
DoCmd.RunSQL "SELECT [transtable].*, emptable.EMail INTO wk_query FROM
[transtable] LEFT JOIN emptable ON [transtable].CT_AGT = emptable.CT_AGT;", 0
DoCmd.OutputTo acReport, "Weekly Detail Counts", "RichTextFormat(*.rtf)",
"testoutfile_" & AOR_AGT_BUS_ID, False, "", 0
BegCt = BegCt + 1
Loop
End If
End Function
employee, put the transactions into a report,
then email the file to the employee
for example:
emptable contains employee number and email address
empnum
transtable contains transactions and employee number for each transaction
empnum
transtype
amount
I've been trying to do this in a loop, but it outputs all employees to a
report. I don't know how to code this so that it would go through
the emptable one by one to do this.
Function Macro2()
Dim BegCt As Integer
Dim MaxCt As Integer
BegCt = 1
MaxCt = DCount("*", "emptable")
If BegCt <= MaxCt Then
Do
DoCmd.RunSQL "SELECT [transtable].*, emptable.EMail INTO wk_query FROM
[transtable] LEFT JOIN emptable ON [transtable].CT_AGT = emptable.CT_AGT;", 0
DoCmd.OutputTo acReport, "Weekly Detail Counts", "RichTextFormat(*.rtf)",
"testoutfile_" & AOR_AGT_BUS_ID, False, "", 0
BegCt = BegCt + 1
Loop
End If
End Function