Access.2007.VBA.Bibl..

(John Hannent) #1
With tsk
strTaskName = Nz(.Subject)
dteStartDate = Nz(.StartDate)
dteDueDate = Nz(.DueDate)
lngStatus = Nz(.Status)
lngPriority = Nz(.Importance)
strDescription = Nz(.Body)
lngPercentComplete = Nz(.PercentComplete)
End With

With rst
rst.AddNew
![Subject] = strTaskName

If dteStartDate <> #1/1/4501# Then
![Start Date] = dteStartDate
End If

If dteDueDate <> #1/1/4501# Then
![Due Date] = dteDueDate
End If

‘Convert Priority number to text for Access
strPriority = Switch(lngPriority = 1, _
“(1) High”, _
lngPriority = 2, “(2) Normal”, _
lngPriority = 3, “(3) Low”, _
0, “”)
![Priority] = strPriority

Convert the Status numeric value to text for Access.


strStatus = Switch(lngStatus = 0, _
“Not started”, _
lngStatus = 1, “In progress”, _
lngStatus = 2, “Completed”, _
lngStatus = 3, _
“Waiting on someone else”, _
lngStatus = 4, “Deferred”, _
0, “”)
![Status] = strStatus

If lngPercentComplete > 0 Then
lngPercentComplete = _
lngPercentComplete / 100
End If

![PercentComplete] = lngPercentComplete
![Notes] = strDescription

Working with Outlook Items 8

Free download pdf