General discussion

  • Creator
  • #2284272

    Access 2002


    by makita ·

    In Access 2002, how can I click on a command button and send an email containing an excel spreadsheet with the results of a query? The query should be ran at the same time. Can this be done?


All Comments

  • Author
    • #2683249

      Reply To: Access 2002

      by iht4 ·

      In reply to Access 2002

      Try the following command

      expression.SendObject(ObjectType, ObjectName, OutputFormat, To, Cc, Bcc, Subject, MessageText, EditMessage, TemplateFile)

      Examples as shown in help file: This code includes the Employees table in a mail message in Microsoft Excel format and specifies To, Cc, and Subject lines in the mail message. The mail message is sent immediately, without editing.

      DoCmd.SendObject acSendTable, “Employees”, acFormatXLS, _
      “Nancy Davolio; Andrew Fuller”, “Joan Weber”, , _
      “Current Spreadsheet of Employees”, , False

      Change the acsendtable to acsendquery should provide you with the result you are looking for.

      Good luck

    • #2682912

      Reply To: Access 2002

      by makita ·

      In reply to Access 2002

      This question was closed by the author

Viewing 1 reply thread