Introduction - Setting up the new project
Add the Code
- Be sure to install the Access 2007 VBA Composite Controls template in your templates directory before continuing.
- Start Access and, in the upper left corner, click on the link, "VBA Composite Controls", then click on the project template and create the new project.
- Open the VBA Editor by pressing ALT + F11.
- We need to import files. Press CTRL+M.
- Select the directory where the Composite Controls source code resides, and drill down to the
Source\Composite Controls\cControl_WebButton directory.
- Import all files in the Classes and Support directories.
- Import the cControl_EventHandler_Section.cls class file from the Source\Core\Classes directory.
- Save the project (and all the imported files).
Once the project files have been set up, uncomment the following code in the
GetHandler() procedure of the Support_CompositeControlManager module to implement the WebButton control:
Set GetHandler = New cControl_EventHandler_Section
Set GetHandler = New cControl_WebButton
Set GetHandler = New cControl_EventHandler_WebButton
Add the Controls
1. Open the Startup Form in design view.
2. Add a TabControl to the form.
3. Change the TabControl properties as follows:
A. Under the Format tab, change Backstyle to Transparent.
B. Chage Style to None.
4. Add a Rectangle object to the Form. Make sure it's Top, Left, Width and Height properties match those of the TabControl.
5. Add a CommandButton to the Form.
6. Change the CommandButton properties as follows:
A. Under the Format tab, change Transparent to Yes.
B. Under the Other tab, set the Tag property to 0.
C. Change the Name property to "Command_Tab1".
C. Change Cursor On Hover to "Hyperlink hand".
7. Add a label. Type "Page One" for a caption. Modify the properties as follows:
A. Under the Other tab, change the Name property to "Label_Tab1".
B. Under the Format tab, make sure the Top, Left, Width, and
Height properties match those of the CommandButton.
C. Set the Text Align Property to Center.
D. Right-click on the CommandButton / Label controls. If the Label control is on top, select
Position -> Send To Back.
E. Position the CommandButton / Label controls above the TabControl at the far left. This is the first WebButton tab.
F. Copy CTRL+C and Paste CTRL+V the controls. Position the second set to the immediate right of the first set.
8. Modify the properties of the second set of controls as follows:
A. Under the Format tab of the Label control, change the Caption to read,
B. Under the Other tab of the Label control, change the Name property to read
C. Under the Other tab of the CommandButton control, change the Name property to read
D. Set the Tag property to 1.
9. Now select the first Page control of the TabControl and make it active.
10. Create a Label Control on the active Page control. Give it the caption, "Page One".
11. Repeat Steps 9 and 10 for the second page of the TabControl, but set the Label's caption to "Page Two".
When you're done, the Form should look similar to this:
Save the form and close it.