Clear table of old data.
strSQL = “DELETE * FROM tblImportedCalendar”
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(“tblImportedCalendar”)
Iterate through the appointments in the local Calendar folder and import them to the Access table.
For Each itm In fldCalendar.Items
If itm.Class = olAppointment Then
Set appt = itm
With appt
strApptName = Nz(.Subject)
dteStartTime = Nz(.Start)
dteEndTime = Nz(.End)
strLocation = Nz(.Location)
strDescription = Nz(.Body)
End With
With rst
rst.AddNew
![Subject] = strApptName
If dteStartTime <> #1/1/4501# Then
![Start Time] = dteStartTime
End If
If dteEndTime <> #1/1/4501# Then
![End Time] = dteEndTime
End If
![Location] = strLocation
![Description] = strDescription
.Update
End With
End If
Next itm
rst.Close
DoCmd.OpenTable “tblImportedCalendar”
ErrorHandlerExit:
Exit Function
ErrorHandler:
Part II Writing VBA Code to Exchange Data between Office Components