This project is read-only.

Introduction - Setting up the new project

Add the Code

  1. Be sure to install the Access 2007 VBA Composite Controls template in your templates directory before continuing.
  2. 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.
  3. Open the VBA Editor by pressing ALT + F11.
  4. We need to import files. Press CTRL+M.
  5. Select the directory where the Composite Controls source code resides, and drill down to the Source\Composite Controls\cControl_WebButton directory.
  6. Import all files in the Classes and Support directories.
  7. Import the cControl_EventHandler_Section.cls class file from the Source\Core\Classes directory.
  8. 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:

    Case ccControl_EventHandler_Section
        Set GetHandler = New cControl_EventHandler_Section


    Case ccControl_WebButton
        Set GetHandler = New cControl_WebButton
    Case ccControl_EventHandler_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, "Page Two".
B. Under the Other tab of the Label control, change the Name property to read "Label_Tab2".
C. Under the Other tab of the CommandButton control, change the Name property to read "Command_Tab2".
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.

That's it! Now move on to Part I - Create and implement the cControl_WebTabConrol class.

Last edited Feb 17, 2011 at 11:31 AM by vba_junkie, version 13


No comments yet.