Microsoft KB Archive/147633

= ACC: How to Run Schedule+ from MS Access Using Automation =

Article ID: 147633

Article Last Modified on 1/19/2007

-

APPLIES TO


 * Microsoft Access 95 Standard Edition
 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q147633



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:

 Create a new form not based on any table or query in Design View. Add a command button to the form as follows:

Command button:

Name: RunSchedulePlus

Caption: Start Schedule+

OnClick: =StartSchedPlus

 On the View menu, click Code to open the form module.  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  Close the Form module and switch the form to Form view. Click the Start Schedule+ button to open Schedule+ and display a schedule for the current user.</ol>

<div class="references_section">