Results 1 to 4 of 4
  1. #1
    Senate is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jan 2016
    Posts
    15

    Get mail recipients from table

    Hi
    I'm using a database for business to write a sort of letter for some other entreprises along a defined road.
    In the header I choose from a combo box the sender and in a second combo box the recipient for the delivery. Both boxes are bound to the table tblAdresses.


    By clicking on the Send-Button the filled-out form is saved and the report of it is prepared to be mailed. I enter all the recipients and it's done.
    I'm now looking to automatize this so that Access knows who to send the report to depending on who I choose as sender and as recipient in my form.
    I created a new table tblMail containing 3 fields: Sender; Recipient; Mailadresses;
    I build it up like that: for instance I have 4 possible adresses 1-4:
    1 - 2 - adresses
    1 - 3 - adresses
    1 - 4 - adresses
    2 - 3 - adresses
    2 - 4 - adresses
    3 - 4 - adresses
    So like that every possibility is covered.
    So how do I realize the code that he looks up between the chosen sender/recipient and my table tblMail? My problem now is that the table is commuative but like that I already have 1035 entries in it.

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    put a list box to hold the recipients.
    choose the combo box sender, then refresh the list box of reciepients. (the query looks at the combo)
    select emails from tEmails where [from]=forms!myForm!cboFrom

    then the send button will cycle thru the list box sending....

    Code:
    sub btnSend_Click()
    dim vEmail
    dim i as integer
    
    for i = 0 to lstbox.listcount - 1
        vEmail = lstbox.dataitem(i)     'get next item in list
        lstbox = vemail                     'set the list to this item
    
        docmd.sendobject......
    
    next
    end sub

  3. #3
    Senate is offline Novice
    Windows 7 32bit Access 2013 32bit
    Join Date
    Jan 2016
    Posts
    15
    If I got your idea right it is like I choose sender 2 and the list box shows me 3 and 4 and clicking the button sents the report to 3 and 4? But thats not exactly what i meant.
    I have 46 different entries in tblAdresses who can match completly randomly

  4. #4
    Senate is offline Novice
    Windows 7 32bit Access 2013 32bit
    Join Date
    Jan 2016
    Posts
    15
    I tried an If .. Then with
    DLookup("[Adresses]", "tblMail", Me.cboxSender.Column(1) & " " & Me.cboxRecipients.Column(1) = "[Sender]" & " " & "[Recipient]")
    to get me the Adresses from tblMail where the fields Sender and Recipient match the choice in my comboboxes but that didnt work out

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

Similar Threads

  1. Replies: 1
    Last Post: 09-14-2015, 06:38 AM
  2. Sending e-mail to multiple recipients
    By riggsdp in forum Programming
    Replies: 4
    Last Post: 12-01-2014, 12:45 PM
  3. email contents of table to recipients in table
    By BR549 in forum Import/Export Data
    Replies: 5
    Last Post: 10-06-2014, 09:42 AM
  4. Replies: 3
    Last Post: 09-12-2013, 02:19 PM
  5. Replies: 1
    Last Post: 09-14-2012, 10:27 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