Results 1 to 2 of 2
  1. #1
    ilikebirds is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2012
    Posts
    14

    Split Form - Filtered: Send to E-mail

    I have a split form that can be filtered with a combo box. It filters out all "counties" and then shortens the list for me.
    Now I have the following code attached to a Send E-mail button:
    Code:
    Dim oOutlook As Object
    Dim oMail As Object
    Dim strAddr As String
    Dim MyDB As DAO.Database
    Dim rstEMail As DAO.Recordset
      
    Set oOutlook = CreateObject("Outlook.Application")
    Set oMail = oOutlook.CreateItem(0)
      
    'Retrieve all E-Mail Addressess in tblEMailAddress
    Set MyDB = CurrentDb
    Set rstEMail = MyDB.OpenRecordset("Contractors", dbOpenSnapshot, dbOpenForwardOnly)
    
      
    With rstEMail
      Do While Not .EOF
        'Build the Recipients String
        strEMail = strEMail & ![Email] & ";"
          .MoveNext
      Loop
    End With
    '--------------------------------------------------
      
    With oMail
      .Bcc = Left$(strEMail, Len(strEMail) - 1)        'Remove Trailing ;
      .Body = "Test E-Mail to Multiple Recipients"
      .Subject = "Yada, Yada, Yada"
        .Display
    End With
      
    Set oMail = Nothing
    Set oOutlook = Nothing
      
    rstEMail.Close
    Set rstEMail = Nothing
    How do I have the recordset open only the filtered recordset and not the entire table?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,948
    Is 'Contractors' the table? You want to use the form's recordsource instead of the table? Try RecordsetClone method. Review http://www.blueclaw-db.com/access_em...nd_outlook.htm
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. DLookup and DMax on a split form filtered sheet
    By JustLearning in forum Forms
    Replies: 12
    Last Post: 12-11-2012, 03:55 PM
  2. Replies: 1
    Last Post: 09-14-2012, 10:27 AM
  3. send a form via mail
    By Fabdav in forum Forms
    Replies: 1
    Last Post: 10-12-2011, 07:35 AM
  4. How to send filtered report via email
    By degras in forum Reports
    Replies: 4
    Last Post: 03-31-2011, 09:09 AM
  5. making a table from a filtered split form
    By stephenaa5 in forum Queries
    Replies: 2
    Last Post: 08-25-2010, 08:56 PM

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