• Outlook data from Access (Access 2002 Sp2)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Outlook data from Access (Access 2002 Sp2)

    Author
    Topic
    #398203

    Does anyone know how to get appointments from an Access Db Calender program to the Outlook Calendar?
    What fields are required? How can I use OLE to do it? Can it be done only one way (from Access to Outlook). Can it be based on a query? Is there existing code to do it?
    It is to work in Access 2000 & XP.

    Viewing 1 reply thread
    Author
    Replies
    • #759501

      I don’t know about Outlook 2000, but Outlook 2002 can import a table from Access. For Calendar Items, you will want to have at least fields Subject, StartDate, StartTime, EndDate and EndTime in the table.

      – Select File | Import and Export…
      – Select “Import from another program or file”, then click Next.
      – Select “Microsoft Access”, then click Next.
      – Click Browse… to select a database, then click Next.
      – Select the Calendar folder, then click Next.
      – Select the table by ticking its check box.
      – Click “Map custom fields”.
      – If the field names in the Access table correspond to those in Outlook, the correspondence will be automatic; otherwise, you will have to drag Access fields to the corresponding Outlook fields.
      – Click OK, then Finish.

      This only works with tables, not with queries.

      You could also use Automation to do this from Access; you would create an instance of Outlook in code and control it from Access. See MSKB article ACC2000: How to Use Automation to Add Appointments to Microsoft Outlook. You can adapt the code given there to loop through the records of a table or query.

      • #759535

        To amplify on Hans’ response a bit, we have use the Automation approach in several instances to create either appointments or tasks in Outlook when records are added or edited in Access. You can also mark a task complete, or change an appointment date/time, and set reminders using that approach. The import option is useful on a one-time basis, but is limited if you want to really tie the two together.

        • #759847

          Thanks Wendell. Do you have any code snippets that would enable me to check if the appnt about to be entered from Access to Outlook is already in Outlook?

          • #759860

            The attached text file contains an example; it is not meant as complete code, but as a starting point.

            The MatchAppointment function takes a start date, start time, end date, end time and subject as arguments and loops through the appointments in the Outlook calendar to look for a match. If found, it returns True.

            • #760042

              Thanks Hans. Not being at all familiar with the Outlook object model, I was groping in the dark. Not any more.
              Tremendous help (as always)
              Regards

            • #760043

              Thanks Hans. Not being at all familiar with the Outlook object model, I was groping in the dark. Not any more.
              Tremendous help (as always)
              Regards

            • #767348

              Edited by HansV to replace ridiculously large screenshot by somewhat smaller one. Please don’t post 1400 pixels wide pictures.

              G’day Hans
              To extend this a little – any idea of the model to create recurring items into Outlook from Access. I’ve been searching the forums and the web for a while without success. I have some idea from my object browser (see attached) but not enought to start coding with …
              Regards Ken

            • #767356

              This is not an Access question. Once you know how to create a recurring item in Outlook VBA, it is a (relatively) simple matter of creating an Outlook application object, as in the code I attached to a previous reply in this thread, and use this object to execute the Outlook code. I suggest that you post a question in the Outlook forum on how to create a recurring appointment in Outlook VBA.

            • #767358

              No worries. Someone has already posted in the Outlook forum (64386) – I’ll keep an eye on that one.
              Regards Ken

            • #767359

              No worries. Someone has already posted in the Outlook forum (64386) – I’ll keep an eye on that one.
              Regards Ken

            • #767357

              This is not an Access question. Once you know how to create a recurring item in Outlook VBA, it is a (relatively) simple matter of creating an Outlook application object, as in the code I attached to a previous reply in this thread, and use this object to execute the Outlook code. I suggest that you post a question in the Outlook forum on how to create a recurring appointment in Outlook VBA.

            • #767349

              Edited by HansV to replace ridiculously large screenshot by somewhat smaller one. Please don’t post 1400 pixels wide pictures.

              G’day Hans
              To extend this a little – any idea of the model to create recurring items into Outlook from Access. I’ve been searching the forums and the web for a while without success. I have some idea from my object browser (see attached) but not enought to start coding with …
              Regards Ken

          • #759861

            The attached text file contains an example; it is not meant as complete code, but as a starting point.

            The MatchAppointment function takes a start date, start time, end date, end time and subject as arguments and loops through the appointments in the Outlook calendar to look for a match. If found, it returns True.

          • #759884

            Hans has provided a good start, so let me just add a small point we uncovered that may be useful. In general, users will want to add their own appointments manually, and it becomes important to not mess with those inadvertently when using automation. To deal with that we set a special field in one of the optional Outlook fields where we stored a primary key value associated with the Access appointment, and we then used that to make sure we were dealing with an appointment (or task) that had been created by the Automation routines.

            • #760044

              Thanks Wendell (Gramps). Excellent stuff. Between Hans & yourself, I think I can accomplish what I want.
              The whole thing started when I got a new phone (Nokia 6600) with a synchronizable calender. The only thing that I posses that it will sync with is Outlook, which I don

            • #760045

              Thanks Wendell (Gramps). Excellent stuff. Between Hans & yourself, I think I can accomplish what I want.
              The whole thing started when I got a new phone (Nokia 6600) with a synchronizable calender. The only thing that I posses that it will sync with is Outlook, which I don

          • #759885

            Hans has provided a good start, so let me just add a small point we uncovered that may be useful. In general, users will want to add their own appointments manually, and it becomes important to not mess with those inadvertently when using automation. To deal with that we set a special field in one of the optional Outlook fields where we stored a primary key value associated with the Access appointment, and we then used that to make sure we were dealing with an appointment (or task) that had been created by the Automation routines.

        • #759848

          Thanks Wendell. Do you have any code snippets that would enable me to check if the appnt about to be entered from Access to Outlook is already in Outlook?

      • #759536

        To amplify on Hans’ response a bit, we have use the Automation approach in several instances to create either appointments or tasks in Outlook when records are added or edited in Access. You can also mark a task complete, or change an appointment date/time, and set reminders using that approach. The import option is useful on a one-time basis, but is limited if you want to really tie the two together.

      • #759845

        As usual Hans you are a fount of knowledge. Thanks, this will help enormously.

      • #759846

        As usual Hans you are a fount of knowledge. Thanks, this will help enormously.

    • #759502

      I don’t know about Outlook 2000, but Outlook 2002 can import a table from Access. For Calendar Items, you will want to have at least fields Subject, StartDate, StartTime, EndDate and EndTime in the table.

      – Select File | Import and Export…
      – Select “Import from another program or file”, then click Next.
      – Select “Microsoft Access”, then click Next.
      – Click Browse… to select a database, then click Next.
      – Select the Calendar folder, then click Next.
      – Select the table by ticking its check box.
      – Click “Map custom fields”.
      – If the field names in the Access table correspond to those in Outlook, the correspondence will be automatic; otherwise, you will have to drag Access fields to the corresponding Outlook fields.
      – Click OK, then Finish.

      This only works with tables, not with queries.

      You could also use Automation to do this from Access; you would create an instance of Outlook in code and control it from Access. See MSKB article ACC2000: How to Use Automation to Add Appointments to Microsoft Outlook. You can adapt the code given there to loop through the records of a table or query.

    Viewing 1 reply thread
    Reply To: Outlook data from Access (Access 2002 Sp2)

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

    Your information: