This sub pulls Outlook Appointments into a table.
The problem is I want to limit the import to Location = Boston
I'm not sure how to code that into the For... To loop - As it is now, I get
the following error:
Run-time error '3163':
The field is too small to accept the amount of data you attempted to add.
Try inserting less data.
Any suggestions very welcome!!! Thanks in advance...
Public Sub Import()
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenR ecordset("tblAp pointments")
Dim ol As New Outlook.Applica tion
Dim olns As Outlook.Namespa ce
Dim cf As Outlook.MAPIFol der
Dim c As Outlook.Appoint mentItem
Dim objItems As Outlook.Items
Dim Prop As Outlook.UserPro perty
Dim iNumApts As Integer
Dim i As Integer
Dim lngEid As Long
Set olns = ol.GetNamespace ("MAPI")
Set cf = olns.GetDefault Folder(olFolder Calendar)
Set objItems = cf.Items
iNumApts = objItems.Count
If iNumApts <> 0 Then
For i = 1 To iNumApts
If TypeName(objIte ms(i)) = "AppointmentIte m" Then
Set c = objItems(i)
If c.Location = Boston Then
rst.AddNew
rst!Location = c.Location
rst!Date = c.Start
rst!Subject = c.Subject
rst.Update
End If
End If
Next i
rst.Close
End If
End Sub