VBA code samenvoegen

Status
Niet open voor verdere reacties.

Mark Boerkamp

Gebruiker
Lid geworden
13 mrt 2010
Berichten
70
Hoi,

Ik heb 2 code's die ik onder 1 knop wil brengen, hoe kan ik deze 2 samenvoegen zodat ze beide worden uitgevoerd met knop Command20 ?

Code:
Private Sub Command20_Click()
        
        Dim mess_body As String
        Set appOutLook = CreateObject("Outlook.Application")
        Set MailOutLook = appOutLook.CreateItem(olMailItem)
                       
            Set appOutLook = CreateObject("Outlook.Application")
            Set MailOutLook = appOutLook.CreateItem(olMailItem)
            With MailOutLook
            .BodyFormat = olFormatRichText
            .To = Me.Email_Address
            .Subject = "PO uitbetalen: " & Me.Mess_Subject
            .HTMLBody = Me.mess_text & " " & "</p>" & "PO: " & Me.mess_text_PO
                 If Left(Me.Mail_Attachment_Path, 1) <> "<" Then
                .Attachments.Add (Me.Mail_Attachment_Path)
            End If
            '.DeleteAfterSubmit = True   'This would let Outlook send th note without storing it in your sent bin
            .Send
            End With
            'MsgBox MailOutLook.Body
            Exit Sub
email_error:
            msgbox "An error was encountered." & vbCrLf & "The error message is: " & Err.Description
            Resume Error_out
Error_out:
End Sub
----------------------------------------------------------------------------------------------------------------------------------
Private Sub Command21_Click()

DoCmd.SetWarnings False
DoCmd.OpenQuery "Qry_Tbl_POMailUpdaten"
msgbox "Toegevoegd"
DoCmd.SetWarnings True
End Sub

Groet,
Mark
 
Heb je dit al geprobeerd?

Code:
            DoCmd.SetWarnings False
            DoCmd.OpenQuery "Qry_Tbl_POMailUpdaten"
            Msgbox "Toegevoegd"
            DoCmd.SetWarnings True
            Exit Sub

email_error:
            msgbox "An error was encountered." & vbCrLf & "The error message is: " & Err.Description
            Resume Error_out
Error_out:

End Sub
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan