using the where command along with a DoCmd.SendObject command

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • neosam
    New Member
    • Mar 2008
    • 47

    using the where command along with a DoCmd.SendObject command

    Hey all,

    I am not able to integrate these 2 actions in one command. What i am doing is...
    A button which sends a report with only specific data to a particular person (via outlook). I am able to filter the records using the where comand and i am able to send using the DoCmd.SendObjec t command. but only seperately. Is it possible to insert the where command in the DoCmd.SendObjec t syntax??

    Thanks
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    Is it possible to insert the where command in the DoCmd.SendObjec t syntax??
    No, there is no WHERE Clause in the SendObject() Method. Modify the Record Source of the Report to correctly Filter the Output.

    Comment

    • neosam
      New Member
      • Mar 2008
      • 47

      #3
      Originally posted by ADezii
      No, there is no WHERE Clause in the SendObject() Method. Modify the Record Source of the Report to correctly Filter the Output.
      Hi,

      But the filter is not always the same. For example if the user requires data from a particular date, only this data should go to the required person. This is where i meet with a problem. is it possible to save a filtered data and then send it each time?

      Thanks

      Comment

      • ADezii
        Recognized Expert Expert
        • Apr 2006
        • 8834

        #4
        I haven't actually tried this, but how about? (I'm using the Catalog Report from the Northwind Database for this example):
        1. Open the Report in Preview Mode Mode specifying your Where Clause
          Code:
          DoCmd.OpenReport "Catalog", acViewPreview, , "[CategoryName]  = 'Beverages'"
        2. Send the Report without listing its Name, this will efault to sending the Active Object
          Code:
          DoCmd.SendObject acSendReport, , acFormatRTF, "BSimpson@aol.com", , , "Subject Matter", "Message Text", False
        3. Close the Report and Save it
          Code:
          DoCmd.Close acReport, "Catalog", acSaveYes

        Comment

        • neosam
          New Member
          • Mar 2008
          • 47

          #5
          Originally posted by ADezii
          I haven't actually tried this, but how about? (I'm using the Catalog Report from the Northwind Database for this example):
          1. Open the Report in Preview Mode Mode specifying your Where Clause
            Code:
            DoCmd.OpenReport "Catalog", acViewPreview, , "[CategoryName]  = 'Beverages'"
          2. Send the Report without listing its Name, this will efault to sending the Active Object
            Code:
            DoCmd.SendObject acSendReport, , acFormatRTF, "BSimpson@aol.com", , , "Subject Matter", "Message Text", False
          3. Close the Report and Save it
            Code:
            DoCmd.Close acReport, "Catalog", acSaveYes

          Yipeeeee.... It works ... thanks

          Comment

          • ADezii
            Recognized Expert Expert
            • Apr 2006
            • 8834

            #6
            Originally posted by neosam
            Yipeeeee.... It works ... thanks
            You are quite welcome, I wasn't actually sure if it would or not.

            Comment

            Working...