Home

Other Windows Controls

 

The Web Browser

 

Introduction

A web browser is control that is used to show a file. The file can be a regular picture or a web address that is identified as a Uniform Resource Locator (URL). A web browser is very flexible with the type of document it can show but of course, you must follow some rules to prepare the document.

The primary type of document intended for a browser is a web page. You probably already know how to create such a document.

A browser can also be asked to display a picture. You can use a picture created by someone else or you must first create and save it as a file. The web browser of Microsoft Windows supports various types of pictures, including those with the extensions .bmp, .jpg, .jpeg, .gif, .png, etc.

A web browser can also receive other types of documents, including PDF or else. When the browser receives such a document, if it can display it, it would. If it cannot, it would send the document to the operating system (OS). The OS would then look for an application that can open the document. It no appropriate application is found, the user may receive an error.

Practical Learning: Introducing the Web Browser

  1. Start Microsoft Access
  2. To start a new database, press Ctrl + N
  3. Set the name to Personal and Professional Interests
  4. Click Create
  5. As a default table has been created, click to Add
  6. In the menu that appears, click Text
  7. Change the name of Field1 to LocationAddress and press Enter
  8. To save the table, right-click the Table1 tab and click Save
  9. Set the name to Interests and click OK
  10. Click the cell under LocationAddress and create the following records:
     
    LocationAddress
    C:\pap\index.htm
    C:\pap\VillageLife.gif
    C:\pap\VillageLife.gif
    http://www.microsoft.com/office
    http://msdn.microsoft.com/access
    http://www.functionx.com/access
  11. Close the table
  12. On the Ribbon, click Create
  13. In the Forms section, click Form Design
  14. Double-click the button at the intersection of the rulers
  15. In the Properties window, click Data
  16. Set the Record Source to Interests
  17. Save the form as Interests
  18. Open Notepad and type the following:
    <html>
    <head>
    <title>Personal Interests</title>
    </head>
    <body>
    <h2>Personal Interests</h2>
    <p>This is a database of my personal and professional interests</p>
    </body>
    </html>
  19. Save the file as index.htm in a folder named pap on the C:\ drive

Characteristics of a Web Browser

A web browser can be added only to a form. To get it, after displaying the form in Design View, in the Controls section of the Design tab of the Ribbon, click the Web Browser Control Web Browser Control and click the form.

A web browser appears as a rectangular control that shows a document within its body. After adding it, you can keep the default border or you can change it to a color or a border type of your choice. As a visual object, the web browser uses many of the other characteristics of Windows controls.

Probably the most important detail of a web browser is the document it displays. This is specified by the Record Source property. You cannot create a web browser on a table. Instead, you can create a text-based field, then use it as the record source of a browser. When performing data entry, enter the name of the file with extension, the complete path and name of the file, or the URL of the web page that the browser would display.

Practical Learning: Creating a Web Browser

  1. In the Controls section of the Ribbon, click Web Browser Control Web Browser Control
  2. Click the form (under the Detail bar).
    If the wizard starts, clic Cancel
  3. Resize and position the web browser as follows
     
    Web Browser
  4. While the web browser is still selected, on the Ribbon, click Arrange
  5. In the Position section of the Ribbon, click Anchoring and click Stretch Down and Accross
  6. Right-click the web browser and click Properties
  7. On the Properties window, click Data.
    Click Control Source and set its value to LocationAddress
  8. To preview the form, right-click its tab and click Form View
     
    Web Browser
     
    Web Browser
     
    Web Browser
     
    Web Browser
  9. Save and close the form

Introduction to Tab Controls

 

Description

A tab control is an object that is used to hold other Windows controls. This control presents a tab button on its top section. This tab button should present a label that indicates what the tab is used for. Sometimes, a tab is also called a property page.

The primary job of a tab control is to "hold", "host", or "carry" other controls. It can appear by itself. Here is an example:

Tab Control

In most cases, a tab control comes in a group with one or more others. In this case, each tab hosts or carries its own controls. Tabs are positioned one in front of the other(s).

To use a tab control, the user clicks a tab. The tab that was clicked comes in front and displays its child controls. The other tab(s) goes(go) to the back and hides(hide) its(their) child control(s). If there is more than one tab, all tabs display a labeled button on top. To change the list, the user simply clicks another tab and the scenario renews. Here is an example:

Tab Control

Tab Control

Practical Learning: Introducing Tab Controls

  1. To start a new database, press Ctrl + N
  2. Set the name to College Park Auto Repair
  3. Click Create
  4. Close the default table without saving it
  5. On the Ribbon, click External Data
  6. In the Import & Link section, click Access
  7. Locate the resources that accompany these lessons
  8. Select Resources.accdb
  9. Click Open
  10. On the Get External Data wizard, click OK
  11. On the dialog box, click RepairOrders
  12. Click OK
  13. On the Get External Data wizard, click Close
  14. On the Ribbon, click Create
  15. In the Forms section, click Form Design
  16. If the Properties window is not visible, double-click the button at the intersection of the rulers.
    In the Properties window, click Data and set the Record Source to RepairOrders
  17. In the Properties window, click Format
  18. Double-click Dividing Lines to set its value to Yes
  19. Right-click the body of the form and click Form Header/Footer
  20. Click the Form Header bar
  21. In the Format tab of the Properties window, change the following characteristics:
    Back Color: Background 2, Darker 50%
    Special Effect: Raised
  22. In the Controls section of the Design Tab of the Ribbon, click Label and click under the Form Header bar
  23. Change its properties as follows:
    Caption: College Park Auto Repair
    Font Name: Garamond
    Font Size: 24
    Font Weight: Bold
    Fore Color: Background 1
  24. Click the Form Footer bar
  25. In the Format tab of the Properties window, change the following characteristics:
    Back Color: Background 2, Darker 50%
    Special Effect: Raised
  26. On the Ribbon, click Design if necessary.
    In the Controls section, click Button and click under the Form Footer bar
  27. Follow the wizard to create a button that would close the form. Set its caption to Close and change its name to cmdClose
  28. To save the form, right-click the Form1 tab and click Save
  29. Set the name to RepairOrders and press Enter
  30. Click the Detail bar
  31. On the Ribon, click Format
  32. In the Font section, click the arrow of the Background Color button and click Tan, Background 2 (Theme Colors: 3rd column - 1st row)
  33. Right-click the form's tab and click Form View
  34. To close the form, click the bottom Close button
  35. When asked whether you want to save the form, click Yes
  36. On the Ribbon, click File
  37. Click Options
  38. Click Current Database
  39. Click Overlapped Windows
  40. Click Remove Personal Information From File Properties On Save (that should also select Compact On Close)
  41. Click OK
  42. On the message box, click OK
  43. Close Microsoft Access

Creating a Tab Control

To create a tabbed control, while the form is in Design View, in the Controls section of the Design tab of the Ribbon, click the Tab Control Tab Control and click the form. By default, after adding a new tab control to a form, it is equipped with two tab pages. Before manipulating a tab control, there are details you should keep in mind.

In the programming world, we consider that a tab control is actually made of two objects presented as one. A tab sheet, also called a property sheet, is like the desk of a table. On a tab sheet, the tab page are positioned on the tab sheet (in Microsoft Access, you cannot access the tab sheet, meaning you cannot place anything on it; in some programming environments, you can certainly access the property sheet). This discussion is intended to show you that there is a separation between the tab control and the area on which it lies. This makes it possible to move all tab controls with one movement.

The tab sheet is a rectangle that surrounds the tab controls and holds them as their parent. To tab sheet is represented by the area on the right side of the tabs. To select that tab sheet, you can click that area:

Tab Controls

Practical Learning: Creating a Tab Control

  1. Start Microsoft Access
  2. Open the College Park Auto Repair database from the previous section
  3. In the Nagivation Pane, under Forms, right-click RepairOrderts and click Design View
  4. In the Controls section, click the Tab Control Tab Control
  5. Position the mouse in the top-left side of the Detail section of the form and click
   
 

Characterics of Tab Controls

 

Introduction

When the tab sheet is selected, you can see that its Name in the Properties window starts with TabCtlX. If you select the tab sheet and move it, the tab pages on it would move also. If you delete the tab sheet, its tab pages would be deleted also. For this reason, the tab sheet is considered their parent.

As mentioned already, the tab pages you use are actually positioned on a tab sheet. Each tab page is considered on its own and its only relationship with the other tabs is that they belong to the same sheet. Based on this, each tab can be accessed separately. To manipulate the properties of a tab page, you should select it first. To do that, click its label (not necessarily its body).

By default, after adding a new tab control to a form, it is equipped with two tab pages. To add a new tab, you can right-click one of the tabs or the area of the tab sheet and click Insert Page:

Tab Control

To remove a tab page, you can click its tab and press Delete. Alternatively, you can right-click a tab and click Delete Page.

The Caption on a Tab

We stated that a tab control (property page) acts as a parent for other controls positioned on it. Based on its role, it should indicate its role. This is specified by a tab, which displays a caption. Therefore, after adding a tab control, one of the first actions you probably should take is to specify its role. This is specified by changing the value of its Caption in the Properties window.

The Widths of Tabs

After typing a string for the Caption of a tab, its width is adjusted to accommodate its string. This is done for each tab. Consequently, one tab with a Personal caption and another tab with Educational Experience as caption, would have different widths:

Tab Control

Alternatively, you can give the same width to all tabs regardless of their different lengths of strings. To give the same width to the tabs, in the Format tab of the Properties window of the tab control (the tab sheet itself), change the value of the Tab Fixed Width property. The default value of 0" means that you let Microsoft Access determine the necessary width to contain the label on the tab. You can then change the value as you wish. Here is an example where all tabs share the same width after the tab control's Tab Fixed Width property has been set (to 1.65"):

Tab Control

The Heights of Tabs

In the same way, the Tab Fixed Height property can be used to control the height of the tabs or buttons.

Pictures on Tabs

You can display either or both a picture and a label on the tab. Although the picture can be any size, you should limit it to 16x16 pixels. Here are examples:

To add a picture to the button, select the tab while in the Design View. In the Properties window, click the Picture property and click its ellipsis button. Locate and select a picture. It should be a bitmap (with bmp extension) or an icon (with ico extension).

If you had specified a picture on a tab but don't want the picture anymore, access the Properties window for that tab. In the Format or the All tab, click Picture to select (Image) and press Delete.

The Style of Tabs

By default, tab pages display their labels on a tab. If you don't like the tabs, you can use either a button or nothing. This characteristic is controlled by the Style property in the Properties window of the tab sheet. This property has three values: Tabs, which is the default, Buttons, and None:

Tab Control Style

Like the Tabs value, the Buttons property allows each tab page to display a label that indicates its role. You can display a button with or without a picture:

Tab Control With Buttons

If you set the Style property to None, the tab sheet would appear as a simple rectangular box and the user would not be able to change the pages:

Tab Control Style: None

Therefore, if you decide to use this option, unless you want to hide the other pages, make sure you provide the user with the means of switching to a different property page.

Based on the role of the tab sheet, some properties of the tab sheet are also imposed on the tab pages. For example, in the Properties window, if you change the value of the Top or the Left properties, the tab sheet moves and at the same time, the corresponding values of the tab pages are changed.

Practical Learning: Creating a Tabbed Form

  1. To add a new tab, right-click the tab control and click Insert Page
  2. Right-click it again and click Insert Page
  3. Click Page1, then click it again until an orange rectangle appears in its body
  4. In the Properties window, click Format, click Caption and type to Order Identification
  5. Click Page2 and make sure an orange rectangle appears in its body
  6. In the Format tab of the Properties window, click Caption and type Parts Used
  7. Click Page3 and make sure an orange rectangle appears in its body
  8. In the Format tab of the Properties window, click Caption and type Jobs Performed
  9. Click Page4 and make sure an orange rectangle appears in its body
  10. In the Format tab of the Properties window, click Caption and type Order Summary

    College Park Auto Repair
  11. Click each tab and design them as follows:
     
    College Park Auto Repair
     
    College Park Auto Repair
     
    College Park Auto Repair
     
    College Park Auto Repair
  12. While the form is still in Design View, click the unbound Total Parts text box
  13. In the Properties window, click All, click Name and type txtTotalParts
  14. On the form, click the unbound Total Labor text box
  15. In the All tab of the Properties window, click Name and type txtTotalLabor
  16. On the form, click the unbound Tax Amount text box
  17. In the All tab of the Properties window, click Name and type txtTaxAmount
  18. On the form, click the unbound Total Order text box
  19. In the All tab of the Properties window, click Name and type txtTotalOrder
  20. Save the form
  21. Preview the form
     
    College Park Auto Repair
  22. Close the form
  23. When asked whether you want to save it, click Yes

The Shape of Tabs

By defulat, the tabs of a tab control appear as rectangular objects. Microsoft Access allows you to change their shapes. To do this, select the table control on the form in Design View. On the Ribbon, click Format. In the Control Formatting section, click Change Shape and click one of the options:

Shape

Here is an example:

Shape

Page Breaks

 

Introduction to Form Breaks

Databases are made of various objects and it is not unusual for one of these objects to contain various fields. If you try to create a form for such an object, you may encounter a space problem. Even if you decide to reduce the amount of information on a table, because you still need to follow your customer’s goal, you may not have this complete liberty. Therefore, instead of deleting necessary fields, you can use one of the various alternatives offered by Microsoft Access.

When logistic becomes a problem for the amount of information you need to include on a form, you can divide the form into sections and allow the user to access only one section at a time, although still remaining in the same form. This is made possible by a special control called the page break.

Creating a Page Break

To create sections on a form, in the Controls section of the Design tab of the Ribbon, click the Page Break Page Break control and click the left side inside the Detail section of a form. You can add as many sections as you want. To make the roles of your form sections efficient, they (the sections) should have the same height. Otherwise, when you decide to display them, part of one section may appear in another section,which would deceive the purpose of creating sections.

To create the sections on a form, isolate different groups of controls. The groups should have the same height. After creating the page break(s), you should reduce the height of the form to the regular size you would like it to display to the user.

Practical Learning: Using a Page Break

  1. From the resources that accompany our lessons, open the Bethesda Car Rental1 database
  2. In the Navigation Pane, under Forms, double-click Customers1 to open it:
     
    Customers
  3. After viewing it, right-click its title bar and click Design View
  4. In the Controls section of the Ribbon, click the Page Break button Page Break
  5. On the form, position the mouse in the Details section at 21/4 of the vertical ruler
     
    Page Break
  6. Then click
  7. Once again, in the Controls section of the Ribbon, click the Page Break button Page Break
  8. On the form, click in the Details section at 4.5 of the vertical ruler
     
    Page Break
  9. While still in the Design View, reduce the height of the form so that the Work Phone label appears in half
     
    Page Break
  10. In the Controls section of the Ribbon, click the More button More and click Control Wizard button to set it off Use Control Wizard
  11. Click the Command Button and click the Form Footer section of the form
  12. Add two more buttons and change their properties as follows:
     
    Page Break
    Button Name Caption
    cmdContact Contact
    cmdPersonalInformation Personal Information
    cmdComments Comments
  13. Save and close the form
 
 
   
 

Previous Copyright © 2010-2012 FunctionX Next