Ray use this....
_____________________________________
Private Sub cmdReminder_Click()
On Error GoTo Err_cmdReminder_Click
Const conerr = 94
Dim stDocName As String
Dim stLinkCriteria As String
Dim strSubject As String
Dim strBody As String
Dim strDueDate As String
Dim strCusName As String
strCusName = DLookup("[CompanyName]", "[Customers]", "[CustomerID]=CustomerID")
strSubject = "Help Desk Ticket: '" & Me.ServiceRecordID & "' (for - " & strCusName & ")"
If Not IsNull(Me.ProblemDescription) Then
strBody = Me.ProblemDescription
Else
MsgBox "You need to Enter a Problem Description", vbCritical, "Missing Info"
Exit Sub
End If
If Not IsNull(Me.FollowUpDate) Then
strDueDate = Me.FollowUpDate
Else
MsgBox "You need to Enter A Follow-Up Date", vbCritical, "Missing Info"
Exit Sub
End If
If Not IsNull(strSubject) Then
ap_CreateOLTask strSubject, strBody, strDueDate
Else
MsgBox "You Need To Enter All Information!", vbCritical, "Missing Information"
End If
Exit_cmdReminder_Click:
Exit Sub
Err_cmdReminder_Click:
If Err = conerr Then
MsgBox "You are Missing Information", vbCritical, "Missing Information"
Exit Sub
Else
MsgBox Err.Description
Exit Sub
End If
End Sub
______________________________________
Public olkApp As Outlook.Application
Public olkNameSpace As Outlook.NameSpace
________________________________________
Public Sub ap_CreateOLTask(strSubject As String, strBody As String, _
strDueDate As String)
Dim objTaskItem As TaskItem
Set olkApp = New Outlook.Application
Set olkNameSpace = olkApp.GetNamespace("MAPI")
Set objTaskItem = olkApp.CreateItem(olTaskItem)
With objTaskItem
.Subject = strSubject
.DueDate = strDueDate
.Status = olTaskInProgress
.ReminderSet = True
.ReminderTime = (strDueDate) & " " & CDate(#9:00:00 AM#)
.Categories = "Task From Access"
.Body = strBody
.Display
End With
Set objTaskItem = Nothing
Set olkNameSpace = Nothing
Set olkApp = Nothing
End Sub
John
|