I was wondering about xp_senmail can I send a report with that procedure to different departments. I wanted some information on how to create a stored procedure and have SQL do the emailing for me. Is this possible
Code:
Private Sub Command165_Click()
On Error GoTo Err_Command165_Click
Dim objOL As Object
Set objOL = CreateObject("Outlook.Application")
Set ol = New Outlook.Application
Dim appOutlook As New Outlook.Application
Dim omItem As MailItem
Dim ReqId As String
ReqId = Me.txt1.Value
Set omItem = appOutlook.CreateItem(olMailItem)
omItem.To = "email_address"
omItem.DeleteAfterSubmit = True
omItem.Subject = "Your subject"
omItem.Body = "Your email body"
omItem.Send
Exit_Command165_Click:
Exit Sub
Err_Command165_Click:
MsgBox Err.Description
Resume Exit_Command165_Click
End Sub