Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Dec 2000
    Location
    Wellfleet, Massachusetts, USA
    Posts
    141
    Thanks
    0
    Thanked 0 Times in 0 Posts

    email report (Office97/professional)

    There are times when I need to send the results of a query, part of a table or a report (rather than the entire database) to others by email. Is this possible? Please tell me how. I am not a developer or extremely sophisticated in Access.

    Thanks for your help.
    LibbieL

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: email report (Office97/professional)

    You can export a query or table to a format like Excel or even plain text, and you can output reports to other formats, although that doesn't work so well because it loses formatting along the way unless you create a snapshot of the report and the other party has the snapshot viewer. If you provide more specific information about what you're trying to do and how you want to send it by email, someone will be able to assist you. Sending them by email doesn't really explain whether you want to send them as attachments or you're expecting the data to be visible in the email and you didn't specify the email application involved. You need to provide as much detail as possible in a request so we know what to suggest.
    Charlotte

  3. #3
    2 Star Lounger
    Join Date
    Dec 2000
    Location
    Wellfleet, Massachusetts, USA
    Posts
    141
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: email report (Office97/professional)

    Charlotte, I wish to send either a query result or a report as an attachment. I use Netscape for my mail client. I maintain a database of members and information for a non-profit organization and periodically need to send a label report or a query result based on specific criteria about members--for example, all members who have the ZIP code beginning with "026". Sorry I wasn't as specific as necessary. Hope I have included everything needed in this reply. Exporting to Excel would certainly be one choice I could use.
    Thanks
    LibbieL

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

    Re: email report (Office97/professional)

    Hello Libby,

    The SendObject method of the DoCmd object may do what you want. You will have to create a query (or report) that selects the information you want to send - if necessary, you can create the query in code. The syntax is (also see the online help)

    DoCmd.SendObject ObjectType, ObjectName, OutputFormat, To, Cc, Bcc, Subject, MessageText, EditMessage, TemplateFile

    Each of the arguments can be omitted.

    ObjectType: acTable, acQuery, acForm, acReport or acModule
    ObjectName: a string containing the name of the database object to be attached
    OutPutFormat: acFormatTXT, acFormatRTF, acFormatHTML or acFormatXLS
    To: a string containing the e-mail address of the addressee or addressees (semicolon-delimited)
    Cc: a string containing the e-mail address of persons receiving a copy
    Bcc: a string containing the e-mail address of persons receiving a blind copy
    Subject: a string used as the subject of the e-mail
    MessageText: a string containing the body of the e-mail message
    EditMessage: boolean, True if you want the view/edit the e-mail before sending it; False if you want it to be sent immediately.
    TemplateFile: the name of a template file (only for HTML)

    Example:

    DoCmd.SendObject ObjectType:=acQuery, ObjectName:="qryMemberSelection", OutputFormat:=acFormatXLS, _
    To:="someone@somewhere.com", Subject:="Member List", MessageText:="Hi" & vbCrLf & "See attached member list" & vbCrLf & "Libby", _
    EditMessage:=False

  5. #5
    2 Star Lounger
    Join Date
    Dec 2000
    Location
    Wellfleet, Massachusetts, USA
    Posts
    141
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: email report (Office97/professional)

    Hans, thanks for the information. Since I haven't fooled around with VBA, it is a bit beyond me. But I did discover that I can export the data object to a file and then attach that file to an email message. All I have to do is to select the object, choose File|Send| and then choose the format--text file, excel , HTML etc. Tried it and it works very well.

    I really must try and use the code that you sent, but I don't know where to begin!
    LibbieL

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

    Re: email report (Office97/professional)

    Hello Libby,

    I had assumed - apparently mistakenly - that you wanted to automate the sending of the e-mail. If sending them interactively by selecting File | Send To is acceptable to you, that's fine, no need for VBA at all.

    (The code I posted could be called in reaction to clicking a command button on a form, for example)

Posting Permissions

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