Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SendObject To based on a query result field 1

Status
Not open for further replies.

ardeen

Technical User
Aug 19, 2009
1
GB
Hi. I have been trying to use the send object command to create an excel file of a query result and email it to an email address that in the query.

Here is the command I have been trying...

DoCmd.SendObject acSendQuery, "qryFilter", acFormatXLSX, [Query]![qryFilter]!, , , "A new record has been logged", "A new record has been logged in the system. Please see the attached file for details and open the system to update your actions"

I have been trying to use [Query]![qryFilter]![email] in the to section but to no avail.

What am I doing wrong?

Also can I take other values from the query and concatenate it to the subject line (i.e. record ID and description).

Many thanks in advance,

Sparky.
 
Hi ardeen,

The problem is that your query isn't executed as part of the SendObject call.

You could try a DLookup with the correct criteria, or alternatively, open the query as a recordset and pull the value from there.

Iain
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top