Results 1 to 5 of 5
  1. #1
    edzigns is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Apr 2011
    Posts
    8

    Auto mail function for on click

    I would like to have an email sent on a 'ticket open' function. Using hosted exchange.

    So on form 'Issues', would like to have the following occur, when clicking on SAVE [on click], outlook opens a new message, populates the following information then sends message automatically:

    To: = support@company.com
    Subject: Ticket [ID] has been opened and is awaiting assignment



    Body: Ticket [ID] has been opened at [OpenedDateTime] by [OpenedBy].

    [Details]

  2. #2
    edzigns is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Apr 2011
    Posts
    8
    Using Outlook 11 (2010) and Access 2003

  3. #3
    timmy is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Posts
    62

  4. #4
    edzigns is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Apr 2011
    Posts
    8

    Re: Auto mail function for on click

    Thank you for the link, I was able to complete the majority of the script necessary. I am still unable to have it send automatically (without clicking send myself).

    Did I miss something?

    Here is my messy code:

    Private Sub CloseCurrent_Click()

    Status.Value = "Closed"
    ClosedDate.Value = Now()
    txtClosedByUser.Value = GetUser()

    Dim stWhereEmail As String '-- Criteria for DLookup
    Dim varTo As Variant '-- Email address to send to
    Dim stText As String '-- E-mail text
    Dim RecDate As Variant '-- Ticket action date for e-mail text
    Dim stSubject As String '-- Subject line of e-mail
    Dim stTicketID As String '-- The ticket ID from form
    Dim stDetails As String '-- Ticket details
    Dim stOpenedBy As String '-- Opened by
    Dim stHelpDesk As String '-- Tech who closed ticket


    '--Opened by
    stOpenedBy = Me.[Opened By]
    '-- Where email addresses found
    stWhereEmail = "Contacts.[Email]"
    '-- Looks up email address from Contacts
    varTo = DLookup("[Email]", "Contacts", stWhereEmail)


    stTicketID = Format(Me.[ID], "00000")
    stDetails = Me.[Details]
    RecDate = Me.[ClosedDate]

    '-- Helpdesk employee ticket assigned to
    strHelpDesk = Me.[Assigned To]

    '--Email subject and details
    stSubject = "Ticket: " & stTicketID & " has been closed"
    stText = "Ticket number: " & stTicketID & " for " & stDetails & " was closed on: " & RecDate & Chr$(13) & Chr$(13) & "If this ticket was closed in error, please contact the Help Desk to re-open ticket." & Chr$(13) & "This is an automated message." & _ " Please do not respond to this e-mail."

    'Write the e-mail content for sending to assignee
    DoCmd.SendObject , , acFormatTXT, varTo, , , stSubject, stText, -1

    End Sub

  5. #5
    timmy is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Posts
    62
    change:
    DoCmd.SendObject , , acFormatTXT, varTo, , , stSubject, stText, -1

    to
    DoCmd.SendObject , , acFormatTXT, varTo, , , stSubject, stText, 0

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

Similar Threads

  1. Click a Button to Run Word Mail Merge...
    By nchesebro in forum Programming
    Replies: 6
    Last Post: 03-09-2011, 01:41 PM
  2. Three forms to one E-Mail
    By Cran29 in forum Forms
    Replies: 1
    Last Post: 02-13-2011, 02:53 PM
  3. Auto Archive Function
    By Desstro in forum Database Design
    Replies: 31
    Last Post: 09-10-2010, 06:21 AM
  4. E-mail Reports
    By Mike Cooper in forum Reports
    Replies: 2
    Last Post: 08-04-2008, 12:58 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