1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Sending Email to multiple directions in one table.

Discussion in 'Business Applications' started by emartz, Aug 9, 2012.

Thread Status:
Not open for further replies.
Advertisement
  1. emartz

    emartz Thread Starter

    Joined:
    Aug 9, 2012
    Messages:
    7
    Hello guys,

    I've found several tutorials explaining how to send emails taking access' contact-forms to outlook, but I'm so noobish in this field and find myself unable to follow them.

    So, I've came here asking you as my last try to do this access thingy :(

    Here's the problem: I've got a form where you can chose from a list-box several student-grants for viewing its info on the text-boxes placed bellow. And just on the bottom of this form, there's a subform with a table which shows the students' info who have signed up for it. (Anyway, I've attached a screen for explaining it better)

    In this table, there's a record for their emails, and what I'm trying to place is a button which automaticaly opens Outlook and has all those emails shown as recipients... but I really have no idea on how to do this.

    Thank you very much

    ps: Sorry if I haven't explained myself very well.:eek:
     

    Attached Files:

  2. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    18,834
    emartz, welcome to the Forum.
    Do you want all the email addresses on the "To" recipient line?
    Do you want to compose the email message in Access or Outlook?
     
  3. emartz

    emartz Thread Starter

    Joined:
    Aug 9, 2012
    Messages:
    7
    Thank you for your fast reply :)

    Yup, I'd like all the email addresses on the To recipient line and compose the email in Outlook

    Again, thanks
     
  4. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    18,834
    Do you get the data for the subform in a query or directly from the table?
    What is the Master/Child Link between the Main and Sub forms?
     
  5. emartz

    emartz Thread Starter

    Joined:
    Aug 9, 2012
    Messages:
    7
    I get the data directly from the table. The master link goes from "CODIGO SUBVENCION" and "CODIGO".

    Is that the info you need?

    Thanks :)
     
  6. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    18,834
    Yes, what is the name of the Table that supplies the email addresses?
    How good are you at creating Queries?
    It would be easier if you created a query based on the student email table with a "Criteria" set to the record on the mainform.

    What version of Access are you using?
     
  7. emartz

    emartz Thread Starter

    Joined:
    Aug 9, 2012
    Messages:
    7
    Being honest, I'm really bad creating queries :3 It took me so long to create that link between the form and the table, so you can imagine...

    I'm using 2010's version :)
     
  8. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    18,834
    What is the name of the Table that supplies the email addresses for the subform?
     
  9. emartz

    emartz Thread Starter

    Joined:
    Aug 9, 2012
    Messages:
    7
    That table is called SOLICITANTES
     
  10. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    18,834
    OK, I think I have found an easier way to this.
    Can you place a Command Button on the Header or Footer of the Subform using the Command button Wizard on the Design View menu?
    The button can be for anything you like, going to the next record would be fine.
     
  11. emartz

    emartz Thread Starter

    Joined:
    Aug 9, 2012
    Messages:
    7
    Sorry for being so late replying

    Yep, I've got the button placed :)
     
  12. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    18,834
    OK, replace all of the VBA code between the opening line and the End Sub with the following.

    Dim rs As Object, count as integer, EmailAddress as string, reccount As Integer, stFileName As String
    On Error GoTo errorcatch
    EmailAddress = ""

    Set rs = Me.Recordset.Clone
    rs.MoveLast
    rs.MoveFirst
    recount = rs.RecordCount
    For count = 1 To recount
    If Not IsNull(rs![CORREO ELECTRONICO]) Then
    EmailAddress = EmailAddress & rs![CORREO ELECTRONICO] & "; "
    End If
    rs.MoveNext
    Next count
    rs.Close
    Set rs = Nothing
    EmailAddress = left(EmailAddress, len(EmailAddress) - 2)
    msgbox EmailAddress

    'MsgBox "emails have been sent."
    Exit Sub
    errorcatch:
    MsgBox Err.Description

    this will go through each of the records in the subform and add the email address to a text string, when it has finished it will give you a message box showing the email addresses that will go in tot the "To" of the outlook message.
    It does not yet open outlook and put it in, to do this you will have to open the VBA Editor's "Library References" using the VBA Editor's Main Menu>Tools>References, click on the side bar of the list and find Microsoft Outlook and tick it.
     
  13. emartz

    emartz Thread Starter

    Joined:
    Aug 9, 2012
    Messages:
    7
    Sorry for my late reply, I had to be off internet during this time :(

    I've pasted it, but it shows a message box saying Item not found in this collection..
     
  14. OBP

    OBP Trusted Advisor

    Joined:
    Mar 8, 2005
    Messages:
    18,834
    Is the field CORREO ELECTRONICO on your form?
    And is that it's Name?
    The Control source and the name of a field can be different.
     
  15. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1064425