Results 1 to 2 of 2

Thread: Emailing a form

  1. #1
    Join Date
    Oct 2009
    Posts
    204

    Unanswered: Emailing a form

    Hello,

    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.

    Code:
    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 = "johndoe@sampledomainname.com"
        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_Command24_Click:
        Exit Sub
      
    Err_Command24_Click:
        Msgbox Err.Description
        Resume Exit_Command24_Click
    
    
    End Sub
    Last edited by Pat Phelan; 01-17-11 at 23:56. Reason: User (Chris07tibgs) request

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    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.
    Paul

Posting Permissions

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