Clear table of old data.strSQL = “DELETE * FROM tblImportedCalendar”
DoCmd.SetWarnings False
DoCmd.RunSQL strSQLSet 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 WithWith rst
rst.AddNew
![Subject] = strApptNameIf dteStartTime <> #1/1/4501# Then
![Start Time] = dteStartTime
End IfIf dteEndTime <> #1/1/4501# Then
![End Time] = dteEndTime
End If
![Location] = strLocation
![Description] = strDescription
.Update
End With
End If
Next itmrst.Close
DoCmd.OpenTable “tblImportedCalendar”ErrorHandlerExit:
Exit FunctionErrorHandler:Part II Writing VBA Code to Exchange Data between Office Components