Results 1 to 4 of 4

Need help writing a macro for when a value is changed in my form (send an email)

  1. #1
    rayted is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2016
    Posts
    29

    Need help writing a macro for when a value is changed in my form (send an email)

    Hi all,



    I am desperate for basic help with writing a macro.

    I am creating a mini IT support system.

    When using the form (see image attached), I want an email notification to be sent when a new ticket has been opened (this could perhaps be using ID, or opened date.

    I have tried researching and writing macros but nothing works! can someone please help?

    Click image for larger version. 

Name:	macro.png 
Views:	8 
Size:	71.4 KB 
ID:	33025

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    6,544
    i guess in your SAVE and NEW button....or email btn.

    Code:
    sub btnSaveAndNew_Click()
    dim sTo as string, sSubj as string , sBody as string
    
    sTo = txtEmail
    sSub = "case# " & txtID 
    sBody = "your problem has been logged"
    
    'if msgbox("Send email") = vbYes then
        docmd.SendObject acSendForm ,"frmMyForm",acFormatPDF,sTo,,,sSubj,sBody
    'endif
    end sub

  3. #3
    rayted is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2016
    Posts
    29
    Thanks Ranman - is there a way in which I can edit the output (it is saving too many screenshots - and as a pdf at the moment). This is all good progress though... thanks!

  4. #4
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    6,544
    send the report version:
    docmd.SendObject acSendReport ,"rMyReport",acFormatPDF,sTo,,,sSubj,sBody

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

Similar Threads

  1. Using macro to send email - question
    By SGrohola in forum Macros
    Replies: 5
    Last Post: 12-04-2017, 01:36 PM
  2. Access 2013 Web App for SharePoint Send Email Macro
    By halliday4400 in forum Access
    Replies: 0
    Last Post: 02-16-2016, 05:54 PM
  3. Replies: 3
    Last Post: 12-28-2015, 03:11 PM
  4. Replies: 3
    Last Post: 02-23-2015, 10:57 AM
  5. Replies: 1
    Last Post: 05-01-2009, 06:33 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Tech Forums: Microsoft Office Forums