Here’s a simple procedure for exporting information from a table to an Outlook calendar.
Q:Elizabeth Moeck wants to know if class name and date information stored in an Access table can be exported to an Outlook calendar
A:Here is a simple procedure that does this:
Dim dbs As Database
Dim rst As Recordset
Dim appOutlook As New Outlook.Application
Dim nms As Outlook.NameSpace
Dim flds As Outlook.Folders
Dim fld As Outlook.MAPIFolder
Dim itm As Object
Dim lngCount As Long
Set nms = appOutlook.GetNamespace(“MAPI”)
Set fld = nms.Folders(“Personal Folders”).Folders(“Class Dates”)
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(“tblClassDates”, dbOpenDynaset)
lngCount = rst.RecordCount
MsgBox lngCount & ” records to transfer to Outlook”
‘Loop through table, exporting each record to Outlook
Do Until rst.EOF
Set itm = fld.Items.Add(“IPM.Appointment”)
itm.Subject = rst!ClassName
itm.Start = rst!ClassDate /p>
itm.Duration = 60
itm.Close (olSave)
rst.MoveNext
ErrorHandlerExit:
Exit Sub
ErrorHandler:
MsgBox “Error No: ” & Err.Number & “; Description: ” & Err.Description
Resume ErrorHandlerExit
Many users have written to me about my suggestion to Sharon Gurbacki about normalizing her movie database tables (see WAW 2.07).
Most mentioned that in the very specific example she gave, of searching the movies with Elizabeth Taylor in the Actor #1 or Actor #2 position, the query would work if the criteria were placed on different query rows, creating an OR condition rather than an AND condition.