Results 1 to 2 of 2

Thread: Emailing a form

  1. #1
    Join Date
    Oct 2009

    Unanswered: Emailing a form


    I have a form that, when the button (command24) is clicked, I want it to send an email, then select a new record for data entry.

    What it does right now is outputs exactly what I want into an email where the user can then click send, then resumes the form at a new record. Everything works as desired, except I'd rather it just bypass the "send" step and place the email in the outbox, so the user never actually sees the email.

    Is there a way to do this?

    Also if possible I would like to find a way to email this without the attachment, as I include all info in the body of the email.

    Private Sub Command24_Click()
    On Error GoTo Err_Command24_Click
        Dim stDocName As String
        Dim stEmail As String
        Dim stSubject As String
        Dim stbody As String
        stDocName = "frm_ChangeRequest"
        stEmail = ""
        stSubject = "Change Request For " & Me!UserInQuestion & "," & Me!CurrentDate
        stbody = ("Name:  " & Me!UserInQuestion & vbCrLf & _
        "Reason:  " & Me!ErrorDescription & vbCrLf & _
        "Sent From:  " & Me!LoginName & " - " & Me!UserName & vbCrLf & _
        "On Computer " & Me!ComputerName & vbCrLf & _
        "at " & Me!CurrentTime)
        DoCmd.SendObject acSendForm, stDocName, acFormatPDF, stEmail, , , stSubject, stbody, , False
        DoCmd.GoToRecord , , acNewRec
        Exit Sub
        Msgbox Err.Description
        Resume Exit_Command24_Click
    End Sub
    Last edited by Pat Phelan; 01-17-11 at 22:56. Reason: User (Chris07tibgs) request

  2. #2
    Join Date
    May 2005
    Nevada, USA
    Provided Answers: 6
    If you look at VBA help on SendObject, you'll see one of the arguments can be set to send no object. Also, one of them controls whether the email is left open for editing or sent directly.

Posting Permissions

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