Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Jun 2001
    Location
    New York, New York, USA
    Posts
    110
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Writing to Outlook Calendar (Access 2002/Outlook 2

    Anyone have some representative code to make the following automation?

    I have a form in Access called TestCalendarItem
    It contains all the fields I will need to make a new meeting / appointment item on an outlook calendar.
    It has a subform called TestLobby
    TestLobby is a short (0 to 4) list of people who need to be invited to a meeting

    At any given period of time I want to run through the recordset of TestCalendarItem and write the information onto the calendar and then loop through the sub form to capture any To: information, send/save & close the item and then run an update query to remove the fields from the query. (the update query does not need to be part of the answer here, I already created that)

    One hang up... I have more than one calendar that I have ownership of. So I need to be able to designate the particular calendar this is written to... I do not want it to end up on my own calendar which is called JW. I need it to end up on the calendar called MP.

    As far as fields go... TestCalendarItem contains subject, event date, begin and end time, note. (In future I might want to include a category field)
    Test Lobby contains an alias field which is the outlook alias for the invitees (it could have email addresses in it instead)

    Any insight is appreciated.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Writing to Outlook Calendar (Access 2002/Outlook 2

    You'll find some sample code in Using Automation in Microsoft Office Access 2003 to Work with Microsoft Office Outlook 2003.
    To create an appointment in a specific calendar, don't use CreateItem(olAppointmentItem) as in the example given there, but create a reference to the appropriate folder, and use Items.Add(olAppointmentItem)

  3. #3
    2 Star Lounger
    Join Date
    Jun 2001
    Location
    New York, New York, USA
    Posts
    110
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Writing to Outlook Calendar (Access 2002/Outlo

    Thanks Hans...

    This code goes a long way but doesn't help me with looping through the subform recordset to get the to: information. Any ideas on that?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Writing to Outlook Calendar (Access 2002/Outlo

    You'd use something like this (the code uses DAO, so you must set a reference to the Microsoft DAO 3.6 Object Library in Tools | References...). You'll have to substitute the appropriate names.
    <code>
    Dim dbs As DAO.Database
    Dim rst As DAO.Recordset
    Dim strSQL As String

    Set dbs = CurrentDb
    strSQL = "SELECT * FROM tblSubTable WHERE ID = " & Me.ID
    Set rst = dbs.OpenRecordset(strSQL, dbFailOnError)

    ' Loop through the records
    Do While Not rst.EOF
    objAppointment.Recipients.Add rst!Email
    Loop

    rst.Close
    Set rst = Nothing
    Set dbs = Nothing
    </code>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •