Results 1 to 10 of 10
  1. #1
    Bronze Lounger
    Join Date
    Feb 2001
    Location
    Escondido, California, USA
    Posts
    1,458
    Thanks
    0
    Thanked 1 Time in 1 Post

    Email Snapshot Report

    How can I set up a control that sends a snapshot report to an email recipient <img src=/S/question.gif border=0 alt=question width=15 height=15> -- or at least takes it as far as the Send Email window where one selects the recipient? Right now I have to select the report, click on File | Send, then click on the Snapshot format. At that point it creates the report, inserts it in an e-mail message and waits for me to enter the recipient. I want to have it do all of the above by simply clicking on a control in a form.

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Email Snapshot Report

    Hi Chuck,

    Access 2000 has a SendObject method in the DoCmd Object. You can either do it via macro or code. I would recommend code in your case - so you can pull the TO: address, CC: address and message text directly from the form You could use it like:<pre>Function SendReport()
    DoCmd.SendObject acSendReport, "YourReportName", _
    acFormatSNP, "EmailAddress @ Test.com", , , _
    "Attached Snapshot Report", "Your Message Text", 0
    End Function</pre>

    Please ignore the spaces around the "@" - the lounge thought it was a real email address. The last argument (EditMessage) determines whether the message is sent immediately or is left open for editing.
    Consult the Access Helpfile on the SendObject method for more specifics.
    HTH <img src=/S/thumbup.gif border=0 alt=thumbup width=15 height=15>

  3. #3
    Bronze Lounger
    Join Date
    Feb 2001
    Location
    Escondido, California, USA
    Posts
    1,458
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Email Snapshot Report

    Thanks Mark for such a quick reply.

    I have two questions. First, does this work in Access97? Second, your reference to the Edit Message argument, is that the 0 in the last line of code?

  4. #4
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Email Snapshot Report

    Hi Chuck,

    Sorry for not having the Access 97 info for you in the first reply. I didn't have a computer around with Access 97 at the time.
    Yes. Access 97 does support the SendObject method (and macro). The only issue I can think of is that you need SP-1 (I think) to add the Snapshot option. I don't think it was avaliable before the service release. (It's possible that it came with SR-2, but I can't remember.)

    Yes, the 0 in the last line of code is for the Edit Message argument. I must make a small correction - the Edit Message arguemtn is not the last argument, but it is the last one that I included in the example.

    Good luck <img src=/S/thumbup.gif border=0 alt=thumbup width=15 height=15>

  5. #5
    Bronze Lounger
    Join Date
    Feb 2001
    Location
    Escondido, California, USA
    Posts
    1,458
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Email Snapshot Report

    Mark,

    I have Access97 SR-1. It has the snapshot option in the send-to routine, but the "acFormat.." command doesn't appear in the list of available "ac..." commands. Perhaps it's time to bite the bullet and acquire Access 2000.

    Just curious, but why would you set it up as a Function (which is normally used to return a value) instead of a Sub with the OnClick option <img src=/S/question.gif border=0 alt=question width=15 height=15>

    Thanks for your help.

  6. #6
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Email Snapshot Report

    Hi Chuck,

    Actually, Access 2000 doesn't list the acFormatSNP either! I had to look quite hard to find it. It's actually listed under the list of constants in the Object Browser, but the helpfiles seem to leave it out (big surprise!).

    The reason I used a Function is because I was typing my test code into a module (and I did it in a hurry) instead of a class module with a form. I guess I just copied and pasted without actually taking time to make the change to sub. Good eye though <img src=/S/eyeout.gif border=0 alt=eyeout width=15 height=15>!

  7. #7
    4 Star Lounger
    Join Date
    Dec 2000
    Location
    London, Ontario, Canada
    Posts
    437
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Email Snapshot Report

    Hi Mark:
    I'd really like to be able to do this but I can't find acFormatSNP on my Access'97 SR-2 system. Not with the object browser, and when I attempt to execute the code, it chokes on acFormatSNP. Am I missing something ? <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>

  8. #8
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Email Snapshot Report

    Hi Brian.....DOH!! <img src=/S/headthrob.gif border=0 alt=headthrob width=15 height=15>

    The choice for sending out to Snapshot format is available in the macro. However, you're right...I could not find it in the object browser. I'm a bit puzzled by this too.

    I'll keep looking into this - but there has to be some solution. If the macro will send out to Snapshot, there HAS to be a way to do it with code.
    <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>

  9. #9
    4 Star Lounger
    Join Date
    Dec 2000
    Location
    London, Ontario, Canada
    Posts
    437
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Email Snapshot Report

    Hey Mark:
    Macro huh, never thought of that, created a macro, converted to basic and got:
    DoCmd.SendObject acReport, "rptTestReport", "SnapshotFormat(*.snp)", "myaddress @ test.com", "", "", "Snapshot Report", "Enclosed is the latest report in SNP format", False, ""
    and it works like a charm. I keep forgetting how handy it is to use macros and then convert to basic.
    <img src=/S/thumbup.gif border=0 alt=thumbup width=15 height=15>
    Oh the mysteries of Access.

  10. #10
    Bronze Lounger
    Join Date
    Feb 2001
    Location
    Escondido, California, USA
    Posts
    1,458
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Email Snapshot Report

    Hi Brian,

    I tried your code and it works like a champ! Thanks a bunch. One more Access mystery solved!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •