ACC: How to Use Automation to Run Schedule+ from MS Access

ID: Q147633

The information in this article applies to:

SUMMARY

Advanced: Requires expert coding, interoperability, and multiuser skills.

This article shows you how to use Automation to run Schedule+ from Microsoft Access to display a schedule for the current user .

This article assumes that you are familiar with Visual Basic for Applications and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information about Visual Basic for Applications, please refer to your version of the "Building Applications with Microsoft Access" manual.

MORE INFORMATION

The following example creates a form that has a command button on it that runs Schedule+ and displays a schedule for the current user.

To run Schedule+ from a Microsoft Access form, follow these steps:

1. Create a new form not based on any table or query in Design View.

2. Add a command button to the form as follows:

      Command button:
      Name: RunSchedulePlus
      Caption: Start Schedule+
      OnClick: =StartSchedPlus()

3. On the View menu, click Code to open the form module.

4. In the General section of the module, add the following function:

   '--------------------------------------------------------------------
   ' This function sets an object variable to the Schedule+ Application
   ' object using the CreateObject() function. Then, it checks
   ' the LoggedOn data member to determine if the current user is
   ' logged-on. If not, it displays an InputBox for entering a user
   ' profile and then logs-on to Schedule+. Once logged on, the procedure
   ' uses the ScheduleLogged data member to return a schedule for the
   ' current user.
   '--------------------------------------------------------------------

      Public Function StartSchedPlus()
      On Error GoTo StartSchedPlus_Error

         Dim spObj As Object, spSchedule As Object
         Dim UserName As String

         ' Create a Schedule+ object.
         Set spObj = CreateObject("SchedulePlus.Application")

            ' Determine if user is logged on to Schedule+.
            If Not spObj.LoggedOn Then
              UserName = InputBox("Please enter your profile name." & _
                         Chr(13) & Chr(13) & "Example: Nancy Davolio")
              spObj.Logon UserName, " ", True
            End If

         Set spSchedule = spObj.ScheduleLogged
         spSchedule.Activate

         Exit Function

      StartSchedPlus_Error:
         MsgBox "Error: " & Err & " " & Error
         Exit Function
      End Function

5. Close the Form module and switch the form to Form view.

6. Click the Start Schedule+ button to open Schedule+ and display a

   schedule for the current user.

REFERENCES

For information about running Microsoft Outlook from Microsoft Access, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q161012
   TITLE:      VBA: How to Create a New Contact Item in Outlook with 
               Automation

For more information about Automation, search the Help Index for "Automation," or ask the Microsoft Access 97 Office Assistant.

Additional query words:

Keywords          : kbinterop IntpOlea 
Version           : 7.0 97
Platform          : WINDOWS
Hardware          : x86
Issue type        : kbhowto

Last Reviewed: November 21, 1998