Results 1 to 3 of 3
  1. #1
    Join Date
    May 2014
    Posts
    35
    Provided Answers: 2

    Unanswered: email notice when new entry

    I have a form that enters new records into a table. On the form there is a command button that closes the form.
    Code:
    Private Sub Close_Form_Click()
    On Error GoTo Err_Close_Form_Click
    
    
        DoCmd.Close
    
    Exit_Close_Form_Click:
        Exit Sub
    
    Err_Close_Form_Click:
        MsgBox Err.Description
        Resume Exit_Close_Form_Click
        
    End Sub
    This works fine.

    What I would like is an email notification when there is an update. I think the code should go in the command button, but I can not figure it out.

    Any help would be greatly appreciated.

  2. #2
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    495
    Provided Answers: 24
    not really. Closing the form does not indicate a record update.
    youd want the email code ,DOCMD.SENDOBJECT report

    in the record AFTERUPDATE event.
    OR
    in the AFTERUPDATE set a module flag to TRUE.
    THEN when the form is closed send the email

    Code:
    ave a form that enters new records into a table. On the form there is a command button that closes the form.
    Code:
    Private Sub Close_Form_Click()
        if mbIsDirty then docmd.sendobject report
        DoCmd.Close
    end sub

  3. #3
    Join Date
    May 2014
    Posts
    35
    Provided Answers: 2
    ranman256,

    Thank you for your help. Not working. I tried this code and I get an error 2046 :sendobject is not available now"


    Code:
    Private Sub Form_AfterUpdate()
    DoCmd.SendObject acSendNoObject, , , , _
                     "email address", , "New Entry", , False
    
    
    End Sub
    What am I doing wrong?

Posting Permissions

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