Okay, so I figured out how to pull Outlook Appointments into an Access Table
(see below).
But the data comes in the wrong Data Type - how do I convert it from Text to
Long Integer?
For example, If I have a custom Form in Outlook with and "Entity_ID" field,
this number will come into the table as text - and every time I try to do
something with it, I get "data type mismatch".
Is there an operation I can perform on the table to convert to this data to
Long? There may be text strings that were imported in the Entity_ID field,
and I won't care if that data is lost...
Thanks in advance...
Public Sub Import()
On Error GoTo HandleErr
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("tblAppointments")
Dim ol As New Outlook.Application
Dim olns As Outlook.Namespace
Dim cf As Outlook.MAPIFolder
Dim c As Outlook.AppointmentItem
Dim objItems As Outlook.Items
Dim varAppt As Variant
Set olns = ol.GetNamespace("MAPI")
Set cf = olns.GetDefaultFolder(olFolderCalendar)
Set objItems = cf.Items
For Each varAppt In cf.Items
If varAppt.Location <> "United States" And varAppt.Start > Date - 1
Then
rst.AddNew
rst!Location = varAppt.Location
rst!Date = varAppt.Start
rst!Subject = varAppt.Subject
rst.Update
End If
Next
rst.Close
Exit_Here:
Exit Sub
HandleErr:
Select Case Err.Number
Case 3163
Resume Next
Case Else
MsgBox "Error Number " & Err.Number & ": " & Err.Description
Resume Exit_Here
End Select
End Sub