Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2016
    Posts
    14
    Provided Answers: 1

    Unanswered: Need help finding code for automatic email generation

    Hi,

    I have been trying to search for code to help me, but I don't know if I am using the right wording in my search.

    What I am looking for: Code to help generate automatic emails based on a query result threshold.

    Background Info We mail letterers to people that require a response. We mail a followup letter after a certain amount of time. The catch is that each letter we send is certified, and we don't followup until 30 days after we know the signed the first letter.

    What I hope to achieve I want access to send an email reminder to staff when about 20 of the letters previously mailed pass the threshold.

    Is this possible? Is there any links to webpages I can use as code reference?

    Thanks for looking!

  2. #2
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    495
    Provided Answers: 24
    have a list box (here its: lstEmails)
    your query will populate the list. I have a combo box that lets me pick the query i need,
    once chosen this query is assinged to the listbox.
    yours would be "Letters 20 days late","qsLateLetters20days"
    then the SEnd button would scan the listbox and sent the letter using this code.

    Code:
    '------------
    Public Sub btnSendEmails_click()
    '------------
    Dim vTo, vSubj, vBody, vRpt, vID
    Dim vFilePath
    dim i as integer
    
    vRpt = lstEmails.Column(2)       'this query has the letter name in 3rd column.
    vBody = "body of email"
    vSubj = vRpt
    vFilePath = ""  'path of the snapshot or XL or PdF
    
         'scan the list box
    For i = 0 To lstEmails.ListCount - 1
       vID = lstEmails.itemdata(i)
       lstEmails = vID
    
    	'get the email address (mine is in col1)
       vTo = lstEmails.Column(1)  
             'send the email
       DoCmd.SendObject acSendReport, vRpt, acFormatPDF, vTO, , , vSubj, vBody
    Next
    End Sub

  3. #3
    Join Date
    Jan 2016
    Posts
    14
    Provided Answers: 1
    Thanks, I will try this out over the next couple of days

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •