Hi there,
I have created a helpdesk database that works the way it should. When I close the helpdesk call I would like the code behind the "Close Call" button to mail the actual user that logged the call. I have created the code that can mail to the address I type into the code but how do I get the code to mail the user that corresponds to the call I am closing.
I have the address of the user that logged the call as a hidden field in the form. see code below whick also includes a date and time stamp when I close the call.
Private Sub Command77_Click()
Me.[Date Closed] = Date
Me.[Time_Closed] = Time
DoCmd.Close
Dim olApp As Object
Dim objMail As Object
On Error Resume Next 'Keep going if there is an error
Set olApp = GetObject(, "Outlook.Application") 'See if Outlook is open
If Err Then 'Outlook is not open
Set olApp = CreateObject("Outlook.Application") 'Create a new instance
End If
'Create e-mail item
Set objMail = olApp.CreateItem(olMailItem)
With objMail
'Set body format to HTML
.BodyFormat = olFormatHTML
.To = "[me.helpdesk_engineer_fault_full].[mail address]"
.Subject = "Your Helpdesk Call Has Been Closed"
.HTMLBody = "Your helpdesk call has now been resolved. please login and rate your support experience"
.send
End With
MsgBox "Operation completed successfully"
End Sub
I have created a helpdesk database that works the way it should. When I close the helpdesk call I would like the code behind the "Close Call" button to mail the actual user that logged the call. I have created the code that can mail to the address I type into the code but how do I get the code to mail the user that corresponds to the call I am closing.
I have the address of the user that logged the call as a hidden field in the form. see code below whick also includes a date and time stamp when I close the call.
Private Sub Command77_Click()
Me.[Date Closed] = Date
Me.[Time_Closed] = Time
DoCmd.Close
Dim olApp As Object
Dim objMail As Object
On Error Resume Next 'Keep going if there is an error
Set olApp = GetObject(, "Outlook.Application") 'See if Outlook is open
If Err Then 'Outlook is not open
Set olApp = CreateObject("Outlook.Application") 'Create a new instance
End If
'Create e-mail item
Set objMail = olApp.CreateItem(olMailItem)
With objMail
'Set body format to HTML
.BodyFormat = olFormatHTML
.To = "[me.helpdesk_engineer_fault_full].[mail address]"
.Subject = "Your Helpdesk Call Has Been Closed"
.HTMLBody = "Your helpdesk call has now been resolved. please login and rate your support experience"
.send
End With
MsgBox "Operation completed successfully"
End Sub