G
Gary Dolliver
Hi all,
is it possible to have a query be filtered by a recordset so that when the
loop is on a record, it would filter the query from the current record? For
example, I have a query that will list outstanding items by employee - each
record that the recordset runs through would be for one employee, is there a
way to then have the query result be for only that one employee? I am
attempting to send emails to employees (one per) and want an attachment to
show the items that relate to them. Here is the code:
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("MANAGEMENT_Typist_Notification_GROUP")
If rst.RecordCount > 0 Then
rst.MoveFirst
Do Until rst.EOF
DoCmd.SendObject acSendQuery,
"MANAGEMENT_Typist_Notification_DETAIL", acFormatHTML, rst!email_address, , ,
"subject", "message", False, ""
rst.MoveNext
Loop
Else
MsgBox ("No Outstanding Items")
End If
The GROUP query lists the employees that need to be emailed, and the DETAIL
query lists all outstanding items. How can I filter the DETAIL query by what
the current record is? I tried using rst!employee in the DETAIL query as a
filter, but that did not work. Sorry if this does not make sense, been a
long day
-gary
is it possible to have a query be filtered by a recordset so that when the
loop is on a record, it would filter the query from the current record? For
example, I have a query that will list outstanding items by employee - each
record that the recordset runs through would be for one employee, is there a
way to then have the query result be for only that one employee? I am
attempting to send emails to employees (one per) and want an attachment to
show the items that relate to them. Here is the code:
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("MANAGEMENT_Typist_Notification_GROUP")
If rst.RecordCount > 0 Then
rst.MoveFirst
Do Until rst.EOF
DoCmd.SendObject acSendQuery,
"MANAGEMENT_Typist_Notification_DETAIL", acFormatHTML, rst!email_address, , ,
"subject", "message", False, ""
rst.MoveNext
Loop
Else
MsgBox ("No Outstanding Items")
End If
The GROUP query lists the employees that need to be emailed, and the DETAIL
query lists all outstanding items. How can I filter the DETAIL query by what
the current record is? I tried using rst!employee in the DETAIL query as a
filter, but that did not work. Sorry if this does not make sense, been a
long day
-gary