Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8447851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:16:43+00:00 2026-06-10T10:16:43+00:00

I’m looking to put together some VBA code in access to send out a

  • 0

I’m looking to put together some VBA code in access to send out a bunch of emails at once. These emails each have multiple attachments and multiple recipients.

I have one table in Access where the Primary Key is a list of “Email Report Names” each column contains an email address that this Email Report goes to.

In another table I also have the “Email Report Names” and each column is the filepath on the harddrive of a file to be attached to that email.

I also have two Queries that call on these tables and filter by the Email Report Name which is filled into the criteria field by a custom function.

I’ve got the outlook coding working fine to send emails from Access. But I’m totally clueless how to make it loop through the different “Email Report Names” then pull the relevent info out of those queries to fill in the recipient lists and attachment lists.

Sorry to not include any example code, but I’m really out to sea on this and don’t even know where to start.

If there are any solutions that are pure VBA with no SQL that would be ideal. I don’t know any SQL yet so I’d have a hard time modifying the code as neccessary even if I do get it initially working.

Thanks,


SELECT FilePaths.MailItem, FilePaths.FilePath1, 
       FilePaths.FilePath2, FilePaths.FilePath2, 
       FilePaths.FilePath4, FilePaths.FilePath5, 
       FilePaths.FilePath6, FilePaths.FilePath7,
       FilePaths.FilePath8, FilePaths.FilePath9, 
       FilePaths.FilePath10, FilePaths.FilePath11, 
       FilePaths.FilePath12, FilePaths.FilePath13, 
       FilePaths.FilePath14, FilePaths.FilePath15, 
       FilePaths.FilePath16 
FROM FilePaths 
WHERE (((FilePaths.MailItem)=EmailItemSelect()));
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T10:16:44+00:00Added an answer on June 10, 2026 at 10:16 am

    The best way to set up your tables is on these lines:

    EmailAddresses

    ID 
    EmailAddress
    OtherDetails
    

    Filepaths

    ID
    MailItem
    FilePath
    

    EmailaddressFilepath

    FilePathID
    AddressID
    

    I am not quite sue what mailitem is, so I left it in.

    The table EmailaddressFilepath contains a match for which address is to receive which items.

    EmailAddresses

    ID     EmailAddress    OtherDetails
    1      joe@example.com Joe Bloggs
    

    Filepaths

    ID    MailItem    FilePath
    1     Help        z:\docs\help.doc
    2     More help   z:\docs\morehelp.doc
    

    EmailaddressFilepath

    FilePathID    AddressID
       1              1
       2              1
    

    You will then need some code

    Dim rs As Recordset
    Dim db as Database
    
    ''Something like
    sSQL="SELECT EmailAddress, Filepath " _
        & "FROM ( EmailaddressFilepath " _
        & "INNER JOIN EmailAddresses ON " _
        & "EmailaddressFilepath.AddressID = EmailAddresses.ID) " _
        & "INNER JOIN Filepaths ON EmailaddressFilepath.FilePathID = Filepaths.ID " _
        & "WHERE FilePathID=1"
    
    
    Set rs = db.Openrecordset(sSQL)
    
    'You now have a recordset with email addresses and attachments
    'there would be other approaches, but this will do for now.
    
     Do While Not rs.EOF
         sEmail=rs!Email
         'set up outlook email
    
         Do While rs!Email=sEmail
         ''Attachment
             sAttach=rs!Filepath 
             rs.MoveNext
             If rs.Eof Then
                exit loop
             End if
         Loop
     Loop
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to loop through a bunch of documents I have to put
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.