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

    Emailing Report Page (2002)

    Well, I thought I had this one licked (see earlier post), and I did -- on my computer running Access 2003.

    However, when I try running it on my wife's machine under 2002 it goes through the motions, but when clicking on Send nothing happens! The code is listed below. Is there something different about 2002 that prohibits sending an email from Access? Do I need some add in to 2002 or what?

    Private Sub cmdEmailReport_Click()
    On Error GoTo Err_cmdEmailReport_Click

    Dim strMessage As String
    Dim strSubject As String
    Dim strDocName As String

    If Me.Dirty Then
    DoCmd.Requery
    End If
    strMessage = "Here is the sheet in Access Snapshot format."
    strSubject = "TOL Assignment Sheet"
    strDocName = "rptShutinsWithVisits"
    DoCmd.OpenReport strDocName, acPreview, , strlinkcriteria
    DoCmd.SendObject acReport, strDocName, acFormatSNP, , , , strSubject, strMessage, True
    DoCmd.Close acReport, strDocName

    Exit_cmdEmailReport_Click:
    Exit Sub

    Err_cmdEmailReport_Click:
    MsgBox Err.Description
    Resume Exit_cmdEmailReport_Click

    End Sub

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Emailing Report Page (2002)

    I don't think the problem is with Access. I have used code like that back in Access 2000 OK.

    Let's just check the requirements, as Send Object tries to use the default email programme.

    * Your wife's computer has a default email programme and it normally works?
    * It allows other programmes to tell it to send email.? This might take some investigation. What is the normal email programme on that computer?
    Regards
    John



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

    Re: Emailing Report Page (2002)

    It looks like the problem may not be with Access. My wife has Office 2002 on her computer and she uses Outlook as her default email handler. I'll try to check it out and see if there is any problem with it. Somewhere in the back of my memory I seem to recall something about problems with accessing Outlook from other applications. Maybe there is a setting somewhere.

  4. #4
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Emailing Report Page (2002)

    What happens if you try using the Menu Command File...Send to ..Mail Recipient...Snapshot format... while you have a report open in Preview Mode?
    Regards
    John



  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Emailing Report Page (2002)

    I tested your code in Access 2002, substituting the name of a report in my database. It worked as intended - see screenshot below (from the Dutch version of Outlook)

    Try setting a breakpoint at the line Private Sub cmdEmailReport_Click(). The code will pause here when the button is clicked. Use F8 to single-step through the code, to see if and where it goes wrong.

    Edited to add omitted screenshot

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

    Re: Emailing Report Page (2002)

    Surprise! This morning I fired up the wife's computer and tried the email bit again -- this time it worked!! The only hitch I found was that it put the message into the Outlook Outbox, but didn't trigger a Send/Receive even though the Outlook option for "send immediately" is set. However, that is only a minor inconvenience as the message goes out eventually.
    Thanks for all your suggestions. I did find that a 2002 SP2 security update can cause some problems with accessing Outlook from other apps, but it looks like this is not the case this time.

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Emailing Report Page (2002)

    If you try to set the recipient (the To:, Cc: or Bcc: address) in code, you'd get a security warning. But just creating an e-mail is OK.

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

    Re: Emailing Report Page (2002)

    Thanks for the warning. I"m not setting the recipient in code as they change from one time to the next.

Posting Permissions

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