Results 1 to 7 of 7
  1. #1
    GGCR is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2014
    Posts
    6

    Emailing one Record


    I have created a database where I will need to send specific records to managers via email which I need to use to collect data. I presently can send an entire table but would like to know how to set this up for individual records.

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Does your table have a primary key? (auto number field for instance)

    If so you can select the record from, say, a list box then export the single selected record. If you don't have a PK in your table it becomes somewhat more problematic.

    Are you looking to include the data from the single record in the body of the email or as an attachment, like a text file or excel file?

  3. #3
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    You can open a report filtered first:

    BaldyWeb - Autofill

    Then email it with SendObject, or use this to filter it from within:

    Emailing a different report to each recipient
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    After you decide how you will filter/select/find the record, here is a snippit to send an attachment based upon a report. You would use strWhere as your where criteria.

    Code:
    Dim strSubject As String
    Dim strBody As String
    Dim strReport As String
    Dim strTo As String
    Dim strCc As String
    Dim strBcc As String
    strSubject = "Insert Subject Line Here"
    strBody = "Insert text to be displayed in the email body"
    strReport = "ReportName"
    strTo = "you@gmail.com"
    strCc = ""
    strBcc = "me@gmail.com"
    
    On Error GoTo Error_Email
    DoCmd.OpenReport "strReport", acViewPreview, , strWhere
    DoCmd.SelectObject acReport, "strReport", False
    DoCmd.SendObject acSendReport, strReport, acFormatPDF, strTo, strCc, strBcc, strSubject, strBody, True
    DoCmd.Close acReport, "strReport"
    
    Exit_MySub:
    Exit Sub
    Error_Email:
    MsgBox "There was an error. Perhaps you cancelled the Email."
    Resume Exit_MySub

  5. #5
    GGCR is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2014
    Posts
    6
    Quote Originally Posted by rpeare View Post
    Does your table have a primary key? (auto number field for instance)

    If so you can select the record from, say, a list box then export the single selected record. If you don't have a PK in your table it becomes somewhat more problematic.

    Are you looking to include the data from the single record in the body of the email or as an attachment, like a text file or excel file?
    I am looking to export a record as a form in outlook. Presently I can only export all the records in the table. I do have a primary key associated with each record.

  6. #6
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Try using this:

    http://msdn.microsoft.com/en-us/libr.../ff197046.aspx

    I didn't work an example but it seems like you should be able to mail the form directly to someone.

  7. #7
    GGCR is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2014
    Posts
    6
    Thank you all so much for your help

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Emailing example
    By pkstormy in forum Code Repository
    Replies: 4
    Last Post: 01-31-2014, 04:22 PM
  2. Emailing Just ONE Record
    By HLTAYLOR in forum Misc
    Replies: 8
    Last Post: 06-26-2013, 12:34 PM
  3. Emailing
    By fastebs in forum Access
    Replies: 2
    Last Post: 04-13-2012, 12:37 AM
  4. Emailing Last Record & exit handling
    By malamute20 in forum Programming
    Replies: 25
    Last Post: 08-24-2011, 05:14 AM
  5. Replies: 2
    Last Post: 08-02-2011, 07:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums