Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2003
    Posts
    4

    Question Unanswered: Emailing reports directly from Access

    I want Access 2000 to email a report to a recipient automatically or with the click of a button. How does it get done?

    Also there is one stipulation, the recipient is generally a user on a Unix based machine, so the email will have to be in text format, in other words they won't be able to read a Word document or attatchment.

    Any and all ideas would be greatly appreciated.

    Thanks.

  2. #2
    Join Date
    Sep 2003
    Location
    T.O.
    Posts
    326
    Tools -> References -> M$ Outlook Object Library

    Dim olApp As New Outlook.Application, myItem As Object, myRecipient As Recipient
    Dim olRecipients As Recipients, strTo As String
    Dim olNameSpace As Outlook.NameSpace

    ' CREATE AN OUTLOOK SESSION
    If Not olApp Is Nothing Then
    Set olNameSpace = olApp.GetNamespace("MAPI")
    If olNameSpace Is Nothing Then
    MsgBox "The Outlook Namespace could not be created"
    Set olApp = Nothing
    GoTo Email_Exit
    End If
    Else
    MsgBox "An Outlook object could not be created"
    Set olApp = Nothing
    GoTo Email_Exit
    End If


    ' CREATE THE EMAIL ITEM
    Set myItem = olApp.CreateItem(olMailItem)

    ' ADD THE INFORMATION TO THE EMAIL ITEM
    With myItem
    .Subject = YourSubject
    .Body = YourTextMessage
    .To = YourEmailAddress
    End With
    myItem.Display

    Set olApp = Nothing


    Email_Exit:
    Exit sub or Function or whatever
    All code ADO/ADOX unless otherwise specified.
    Mike.

  3. #3
    Join Date
    Sep 2003
    Posts
    4
    Hey HomerBoo,

    I hate to be a pain, but I'm still teaching myself VBA coding. Can you give me a basic breakdown of what I need to change within the code to adapt it for my uses. And what fields and data the code draws from to send the data to the various users? Also, what initiates this process? Do I program a button to run the code? Is it an activeXCtl? Or is it part of the tools like it says at the beginning of the code? I know I'm a newbie, but your help is greatly appreciated.

    Thanks again.

  4. #4
    Join Date
    Sep 2003
    Location
    T.O.
    Posts
    326
    Where it says Your... change those to meet your needs. The data can either be hard coded or stored in tables, and I would call it with a command button.
    All code ADO/ADOX unless otherwise specified.
    Mike.

Posting Permissions

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