General Tips for the SQL Workflow ToolbarThis content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
Microsoft® Office XP Developer
Summary: This article discusses several tips for making the Microsoft Office XP Developer Workflow Toolbar more effective for users. The workflow toolbar is an ActiveX control that integrates with data access pages. It displays the workflow events available to the user for each record in the workflow application. (6 printed pages)
Introduction Adding the Workflow Toolbar to Your Access Toolbox Changing the Background and Border Options Showing Only Actions Available to the User Minimizing the Number of Change Buttons Altering the Order in which Buttons Appear on the Workflow Toolbar Adding Script to Trap Workflow Toolbar Events
This article focuses on enhancing the SQL Workflow Toolbar for Microsoft® Office XP Developer SQL Workflow Solutions. Hereafter the SQL Workflow Toolbar will be referred to as the workflow toolbar.
It is assumed that you are familiar with Microsoft SQL Server management, Microsoft Access Data Access Pages, Microsoft Visual Basic® Scripting Language (VBScript), and Microsoft FrontPage® Web sites. In addition, you must have access to computers equipped with Microsoft SQL Server 2000 and Microsoft FrontPage Server Extensions. The recommended operating system is Microsoft Windows® 2000.
Instructions are given with the following assumptions:
- A standard SQL Workflow Solution was created using the Microsoft Office XP Development Environment.
- You are working on a computer where Microsoft Access 2002 is installed.
- You fully installed Microsoft Office XP Developer product.
If you create more than one data access page, you might want to add a button to the Access toolbox for the workflow toolbar. Doing so will enable you to access the workflow toolbar and place it on data access pages without having to scroll through all the available ActiveX elements.
Assuming Microsoft Access 2002 is launched, you previously created a Data Access Page and an Access Data Project, and the Data Access Page is currently in design view, the following steps illustrate how to add a button for the workflow toolbar to the Access toolbox.
Adding a button to the toolbox
- Right-click any area of the Access toolbox, and select Customize from the context menu.
- Select the Commands tab on the Customize dialog box.
- Scroll to the bottom of the Categories list, and select ActiveX Controls.
- Scroll through the Commands list, and select Microsoft Office Developer Workflow Toolbar.
- Drag the selected item from the Commands list onto the Access toolbox.
Now you have the option to leave the button as-is or customize it to resemble other buttons in the toolbox. Customizing the button will make it possible for you to replace the name of the ActiveX object with an icon.
Customizing the newly added button
- Right-click the newly added button.
- Select Default Style if you want to display an icon instead of text for the button face.
- Select Change Button Image to change the default icon for the button face.
- Close the Customize window.
When the workflow toolbar is placed on a data access page, it appears flat because of the default options for both the background color and border color. Fortunately, both of these options are changeable, thus making it possible for the workflow toolbar to be better integrated with your data access page.
Changing the background color
- Make sure the Data Access Page is in Design view and contains the Workflow toolbar.
- Right-click the Workflow toolbar, and select Element Properties from the Context menu.
- On the Format tab, select the text entry box for BackgroundColor. When the BackgroundColor text box is selected, an ellipsis becomes available to the right of the field, making it possible to use the color-picking tool.
- Click the ellipsis (...) to the right of the text entry box to view the color-picking tool. Select one of the predefined colors, or create your own. Alternatively, if you are familiar with RGB values, you can enter in the hexadecimal value. Do not forget to include the pound (#) sign if you enter in an RGB value.
- Save your Data Access Page.
To view the changes you made to the BackgroundColor for the workflow toolbar, you should load the Data Access Page in Internet Explorer or switch to page view mode by selecting View, then Page View, from the menu bar. When you are done previewing your page, you should switch back to design view.
Changing the border options
- Find the BorderStyle entry on the Format tab, and enter in the type of border you want to display. The default value is none, however any of the following values are acceptable:
- Find the BorderColor entry. Here, you can either specify an RGB value or use the color-picker tool to choose the color you want. To launch the color-picker tool, click the ellipsis (...) to the right of the text box.
- Find the BorderWidth entry. For this item, you should choose between medium, thin, and thick. Medium is the default value. In addition, you can specify a specific value, such as 12.75 px. An acceptable value is a floating-point number followed by one of the following units: cm, mm, in, pt, pc, or px.
If your workflow has many transitions, a large number of buttons will appear on the workflow toolbar when the data access page is loaded in Internet Explorer. Because the workflow toolbar displays all of the buttons in a linear fashion, the user will have to scroll horizontally across the page until they find the desired action. By setting the HideUnavailableActions property to True, you can diminish the number of buttons the user is presented with at each workflow state.
Setting the HideUnavailableActions property
- Make sure the Data Access Page is in Design view and contains the Workflow toolbar.
- Select the All tab, and look for the HideUnavailableActions entry.
- Change the value to True.
Performing this task will display only those transitions that the user can access immediately for a particular record. The number of buttons displayed on the toolbar should decrease.
In addition to hiding unavailable actions, you also can reduce the number of buttons displayed on the workflow toolbar by renaming captions for transitions of similar actions. For example, you only need one button to make it possible for the user to edit data at each of the workflow states.
Making use of a common Edit button
Unlike the previous tasks, this task requires you to change items on your workflow.
- Launch the MOD Development Environment, and open the SQL workflow solution.
- Open your workflow process definition by double-clicking the workflow process in the Solution Explorer.
- Locate all the transition-within shapes on the diagram surface.
- Select each one individually, and change the caption value to say Edit.
- Make sure you save the changes to the workflow diagram. If you do not save the changes, the workflow toolbar will not show the updated changes.
- In Internet Explorer, refresh the Data Access Page.
Now, you should have only one Edit button. This button can be used to change values of records at any state in your workflow.
Now that you have one common button to make it possible for users to edit data, you probably want to reorder the buttons, so the edit button is more logically located. Placing the Edit button near the front should make it easy for user to access.
Changing the order in which buttons are displayed
- Load SQL Sever Enterprise Manager.
- Expand the database node for your SQL Server.
- Expand the node for your database.
- Select the Tables item under the database node.
- Right-click the table that ends with the string WorkflowActions.
- In the <maintable>WorkflowActions table, locate the column for Position. In this column, you can add an integer value to specify the order for each action. The integer value with the lowest value will be displayed first, followed by the next lowest, and so on.
You can leave some buttons in their default order by leaving their position values as NULL. These buttons will appear after the ordered buttons are displayed.
It is possible to add script to trap certain events that are fired off from the workflow toolbar. This can help you display information to the user in a message box or automatically add values to fields on a data access page. The following steps explain how to add values to a field.
Adding script to auto-populate a field
- Load the Data Access Page in a text editor, such as Microsoft Script Editor.
- Look for the script tag in the HTML source code.
- Just above this script tag, place the following code:
<script language=vbscript event=ClickAction for=ActiveXCtl0> if ActiveXCtl0.Event.Caption = "Record Date" szDescription.value = date end if </script>
- Save the script by clicking the Save button.
- Load the Data Access Page in Internet Explorer.
There are numerous methods and events you can call based on the object model for the workflow toolbar and the data access page. In the previous example, szDescription is a field on the data access page. If you want to set focus to this field instead of assigning it a value, type in szDescription.focus on the line that says szDescription.value = date.