MS Access email clients

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • captainmorgan
    New Member
    • Mar 2007
    • 10

    MS Access email clients

    Can anybody tell me how to include my email addresses from a query to the bcc field of a new email.

    I created a query to select my email addresses, I tryied using the VBA code below to extract the email addresses and insert them in a SendObject command, but nothing happens. Please Help.

    Dim db As DAO.Database
    Dim rst As DAO.Recordset
    Dim rcpts As String

    Set db = CurrentDb
    Set rst = db.OpenRecordse t("EmailInfo Clients")
    rcpts = ""

    With rst
    .MoveFirst
    Do Until .EOF
    rcpts = rcpts & .Fields("Email_ Name") & ","
    .MoveNext
    Loop
    End With
    DoCmd.SendObjec t , , , "info@sharpeway group.ca", , rcpts, , , True

    rst.Close
  • MMcCarthy
    Recognized Expert MVP
    • Aug 2006
    • 14387

    #2
    Try using a semicolon after the email names instead of a comma.
    Code:
    Dim db As DAO.Database
    Dim rst As DAO.Recordset
    Dim rcpts As String
    
       Set db = CurrentDb
       Set rst = db.OpenRecordset("EmailInfo Clients")
       rcpts = ""
    
       With rst
    	  .MoveFirst
    	  Do Until .EOF
    		 rcpts = rcpts & .Fields("Email_Name") & ";"
    		 .MoveNext
    	  Loop
       End With
    
       DoCmd.SendObject , , , "info@sharpewaygroup.ca", , rcpts, , , True
    
       rst.Close
    Mary

    Comment

    • captainmorgan
      New Member
      • Mar 2007
      • 10

      #3
      I tried adding the semi-colon; still nothing

      When I debug the code, I get no errors, when I run the command, I get no results and no errors...

      What else could I try?

      Comment

      • captainmorgan
        New Member
        • Mar 2007
        • 10

        #4
        In the code that I included in the first thread, Can you tell me if I have enough information in the following code;

        Set rst = db.OpenRecordse t("EmailInfo_Cl ients")

        The query name that I want to use as the record source is EmailInfo Clients (no underscore), although I've tried this with underscore, no underscore with [ ] and without the [ ]

        Comment

        • MMcCarthy
          Recognized Expert MVP
          • Aug 2006
          • 14387

          #5
          Originally posted by captainmorgan
          In the code that I included in the first thread, Can you tell me if I have enough information in the following code;

          Set rst = db.OpenRecordse t("EmailInfo_Cl ients")

          The query name that I want to use as the record source is EmailInfo Clients (no underscore), although I've tried this with underscore, no underscore with [ ] and without the [ ]
          Firstly remove the underscore and just leave it as

          Code:
           Set rst = db.OpenRecordset("EmailInfo Clients")

          Comment

          • MMcCarthy
            Recognized Expert MVP
            • Aug 2006
            • 14387

            #6
            Open the immediate window in the VBA editor and add this Debug.Print command as below. See what the printout is in the immediate window.

            Code:
            Dim db As DAO.Database
            Dim rst As DAO.Recordset
            Dim rcpts As String
            
               Set db = CurrentDb
               Set rst = db.OpenRecordset("EmailInfo Clients")
               rcpts = ""
            
               With rst
            	  .MoveFirst
            	  Do Until .EOF
            		 rcpts = rcpts & .Fields("Email_Name") & ";"
            		 .MoveNext
            	  Loop
               End With
            Debug.Print rcpts
            
               DoCmd.SendObject , , , "info@sharpewaygroup.ca", , rcpts, , , True
            
               rst.Close
            Mary

            Comment

            Working...