Results 1 to 9 of 9
  1. #1
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Manassas, Virginia, USA
    Posts
    363
    Thanks
    0
    Thanked 0 Times in 0 Posts

    SendObject using Email (Access 2002)

    I would like to be able to email each of the recipients in my attached sample database using GroupWise email so that each one would receive a different letter as an attachment. On the form I created a command button containing the code that I thought would accomplish this. During testing I used my email address for each record to see if I could accomplish this goal. The code works to send the email but the exact same attachment comes with each email. It is as if the recordset is not moving to the next record or my report is not looking at the recordset and I don't what to do to fix it.
    Judy Jones, Computer Training Specialist
    Manassas, Virginia

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

    Re: SendObject using Email (Access 2002)

    Your report doesn't know anything about the recordset you're using in the code. See <post:=275,460>post 275,460</post:> for a way to send individual reports.

  3. #3
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Manassas, Virginia, USA
    Posts
    363
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SendObject using Email (Access 2002)

    I have worked for quite a while trying to match the coding on the post you referred me to. Somehow I don't quite understand how it is supposed to be working so it makes it harder to troubleshoot when errors occur. I am still getting a duplicate email attachment for each person.
    Judy Jones, Computer Training Specialist
    Manassas, Virginia

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

    Re: SendObject using Email (Access 2002)

    Judy, the idea is to use the public variable gstrEmployeeName both in the code behind the form and in the code behind the report, and use it consistently. You haven't declared gstrEmployeeName as a public variable, and you use different variables in the form and report.

    See the attached version.

  5. #5
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Manassas, Virginia, USA
    Posts
    363
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SendObject using Email (Access 2002)

    Thank you for taking the time to modify my file. I compared all the code in yours to all the code in mine so I could see what changes had been made to help me understand what you did.
    Judy Jones, Computer Training Specialist
    Manassas, Virginia

  6. #6
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Manassas, Virginia, USA
    Posts
    363
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SendObject using Email (Access 2002)

    My previous attachment was simply a test so I could learn how to accomplish the task of sending a different attachment through email based on specific criteria. I applied that to my actual database and have provided the user with a choice of three different reports: LetterD, LetterY, and LetterN. Letters D and N work just fine because the email address receives a separate email with the name of each award nominee. LetterY lists the names of all their nominees in one letter. The report end works fine but I need to surpress multiple emails containing LetterY going to the same email address just because there are multiple records containing the names of the nominees. It is like I need a unique list of email addresses but I can't think of how that could be accomplished or if it would be possible.
    Judy Jones, Computer Training Specialist
    Manassas, Virginia

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

    Re: SendObject using Email (Access 2002)

    You must change the code for cmdSendLtrY_Click:

    ...
    Set rs = db.OpenRecordset("SELECT DISTINCT EMailAdd FROM qryEmailListY", dbOpenDynaset)
    Set Employee = rs!EMailAdd
    Set Employee2 = rs!EMailAdd

    Do While rs.EOF = False
    gstrEmailAdd = Employee2
    ...

  8. #8
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Manassas, Virginia, USA
    Posts
    363
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SendObject using Email (Access 2002)

    That worked perfectly. Thanks so much for your time and trouble. I learn so much from Woody's Lounge not just from your answers to my questions but from all the solutions you provide others as well. In return I try to help support the lounge by purchasing books and ebooks through the WOPR site and authors associated with it. By the way, do you have any books you have written? If not you certainly should.
    Judy Jones, Computer Training Specialist
    Manassas, Virginia

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

    Re: SendObject using Email (Access 2002)

    Thanks for your kind words! And no, I don't write books.

Posting Permissions

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