• Writing to Outlook Calendar (Access 2002/Outlook 2

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Writing to Outlook Calendar (Access 2002/Outlook 2

    Author
    Topic
    #442471

    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.

    Viewing 0 reply threads
    Author
    Replies
    • #1065189

      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)

      • #1065212

        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?

        • #1065221

          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.

          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

    Viewing 0 reply threads
    Reply To: Writing to Outlook Calendar (Access 2002/Outlook 2

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: