Sectional and Tabbed Forms |
|
Sectional Forms
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 in 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, on the Toolbox, click the 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 should have the same height. Otherwise, when you decide to display them, part of one section might 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 sections in the Design View, in the Controls section of the Ribbon, you can click the Insert or Remove Page Break button and, on the form, position the mouse in the area where you want to create a page break and click. If you are planning to create more than one section, add a Page Break in the desired sections. After creating the page break(s), there are a few things you should(must) do. First, you should reduce the height of the form to the regular size you would like it to display to the user. Second, you can create a macro (or write (just a tiny piece of) code) to make the form function the way it should. You should first create a button that would be used to access a section. To create a macro for this functionality, on the Ribbon, click Create and, in the Other section, click Macro (the top portion of the button) . In the Action combo box, select GoToPage (you can also use GoToControl). In the Page Number box, enter 1 for the top section, 2 for the second section, and so on:
Then save the macro. After creating the macro, you must assign it to a control, such as a command button, that would run it. To do this, access the Properties window for the control and access the Event or the All tab. For a command button, you can type the name of the macro in the On Click field:
Instead of first creating a macro before assigning it to command button, as another technique, in the Design View of the form, you can right-click the command button and click Build Events. In the Choose Builder dialog box, you can click Macro Builder and click OK. The new macro would be automatically assigned to the control. In the Action combo box, select GoToPage. In the Page Number box, enter the desired number of the section, and close the macro. You would be asked to save it. You can use any of these techniques to create macros to access the other sections if necessary. Once the functionality has been implemented, the sections can be accessed when the user clicks a button.
Practical Learning: Using a Page Break
|
Tabbed Forms |
Introduction
Besides the page breaks you can use to divide a form, if you are designing a form for a long list of fields, you can group them in tabs. 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:
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:
Adding a Tab Control
To create a tabbed form, while the form is in Design View, in the Controls section of the Ribbon, you would click the 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. If you listened to your teacher in primary or elementary school, you probably heard her saying over and over that you should/must not write on the desk of a table. This is also true here. In real life, everything on a table is positioned on that table, like pieces of paper. 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:
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:
To remove a tab page, you can click its tab and press Delete. Alternatively, you can right-click a tab and click Delete Page.
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 its button, 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 role by changing the value of its Caption in the Properties window.
After you have typed 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 Resume caption and another tab with Personal Information as caption, would have different widths. Alternatively, you can give the same width to all tabs regardless of their different lengths of strings. In this case, a tab with Resume and another with Personal Information labels would have the same width. 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.0458"):
In the same way, the Tab Fixed Height property can be used to control the height of the tabs or buttons.
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. 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).
By default, tab pages display their labels on a tab. If you do not like the tab, 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:
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:
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. 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 difference 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
Subforms and Subreports |
Introduction
A relational database allows you to separate data in objects so that these objects can hold different pieces of information and make data available to other objects that need it. Sooner or later, users constantly need information held by one form or report while they are working on another form or report. There are various ways you can solve such a problem. One solution is to "embed" one form or report into another form or report.
A subform (or a subreport) is a form (or a report) that you position inside of another form (or another report). In order to "include" one form (or report) into another form (or report), both objects must have a relationship, as we have learned in the past. The form (or report) that is hosting the other form (or the other report) is the parent. The form (or report) that is added to the parent is called the child form (or child report). The parent object must have a primary key that "links" or relates it to a foreign key in the child object.
Microsoft Access Automatic Subforms
Microsoft Access provides various techniques you can use to create a subform. Probably the simplest technique consists of using a wizard. This allows you to specify the table or query that is holding the parent records, followed by the table or query that has the child records. Of course, both lists must be able to communicate through the primary key of the parent list and a foreign key in the child list.
To generate a form that contains a subform, start the Form Wizard. In the first page of the wizard, in the Tables/Queries combo box, select the parent object and, in the Available Fields list, select the fields you want to display on the form. Then, in the Tables/Queries combo box again, select the child list. In the Available Fields list, select the fields that the subform should display. Continue with the wizard. In the second page, you must be able to identify the relationship that will control the link between both list. In other words, you must be able to identify the primary key from the parent list and the foreign key from the child list. Once this is clear, you can continue. In the third page of the wizard, you will decide how you want the subform to display, as a tabular list or as a datasheet. After making this decision, you can continue. The fourth page of the wizard allows you to select a preset design you want to apply to the form (and the subform). There is no particular design you need to follow for a subform. After making the selection, you can click Next and Finish.
Practical Learning: Automatically Creating an Auto-Subform
Subforms and Subreport Design |
Introduction
The Form Wizard allows you to quickly create a subform. This would be fine if you just want to review records associates from one table to another. As effective as it can be, it can also provide some functionality you do not need and do not want. Besides that, the Form Wizard imposes some aspects you must simply accept. The alternative it to design your own subform, and you have various options:
All these techniques indicate that you should be able to configure the functionality of the subform as it relates to the form that will host it. When designing a subform, you must also specify its appearance. You have the options as datasheet, tabular, or just regular form.
The Datasheet Subform
As mentioned in Lesson 8, a form can appear as a datasheet like a table. This makes the form appear with columns and records whose intersections are cells. You can also create a subform that display as a datasheet.
To create a subform that would display as a datasheet, start the form in Design View. In the Properties window, set its Default View to Datasheet. When designing the form, you can position the controls anywhere because their positions would not be obvious on the form. Also, the sizes of the labels and fields would not show on the form. When designing the form, you work in Design View. The Datasheet View appears only if you change the view. Although you can use the different sections of a form, for a Datasheet form, the sections would appear only in the Design View, not in Datasheet View.
When adding controls or other objects to a subform (or a form) that would display in Datasheet View. Only the controls you display in the Detail section would appear when the subform comes up. The objects in the other sections would not appear. You can use this feature to your advantage. For example you can add unbound controls in a Form Footer section to hold some values or perform some calculations, then refer to those controls in the parent form.
Practical Learning: Using a Datasheet Subform
The Continuous Form
A variant of the datasheet is the tabular form. As mentioned in Lesson 8, a tabular form displays its records in groups. Instead of showing one record at a time, the form can show as many records as its size allows:
This type of form is referred to as continuous because the records are displayed continuously in the same view. If the number of records is not too high, all of them would display. If there are more records than the form's size can allow to view, some records would be hidden. To view them, you can use the scroll bars.
To create a continuous form, you can use the Form Wizard where, in the second page of the wizard, you would select the Tabular option. To create a continuous form in Design View, set its Default View to Continuous Forms.
Unlike the datasheet form, a continuous form can be equipped with, and can display, other sections than the Detail in Form View. This means that you can include additional fields in the other sections. Based on this, a typical design of a continuous form consists of creating some labels in the Form Header section and positioning their corresponding controls under them but in the Detail section. The fields can be horizontally aligned and adjacent each other. You should (strongly, if not must) avoid including Memo and OLE Objects (pictures, linked documents, etc) in a continuous form because such fields may take too much space. This would deceive the purpose of the continuous form.
Practical Learning: Designing a Subform or Subreport
|
The Single Form
A single form is the type of form that displays its data one record at a time. This concept, which was used on most forms we have used so far, can also be applied to a subform. The single layout can be valuable if you want to show one record from a related form as it is linked to a record on the current form. While a Datasheet form can clearly show that it is an embedded object, the fields of a single form can easily be mixed with those of the hosting form but it is usually determined to be apart.
A single subform is designed like a regular form where fields are created in the Detail section and other optional controls can be added to the other sections of the form. When selecting the fields that would be part of the subform, make sure you include only those that can be useful in the form that will host the subform.
Practical Learning: Designing a Single Subform
|
Record | 1 of 1 |
Processed By: | 28-485 |
Processed For: | 402-22-9644 |
Car Rented: | CAM-422 |
Condition: | Excellent |
Tank Level: | Half |
Mileage Start: | 6422 |
Start Date: | 11/23/2009 |
Order Status: | Car On Road |
Record | 2 of 2 |
Processed By: | 80-485 |
Processed For: | A-378-478-439-384 |
Car Rented: | AFW-928 |
Condition: | Excellent |
Tank Level: | 1/4 Empty |
Mileage Start: | 2028 |
Start Date: | 11/24/2009 |
Order Status: | Car On Road |
Record | 3 of 3 |
Processed By: | 35-079 |
Processed For: | M-028-662-206-814 |
Car Rented: | GMM-186 |
Condition: | Good |
Tank Level: | Full |
Mileage Start: | 10407 |
Start Date: | 11/27/2009 |
Order Status: | Car On Road |
Record | 1 of 3 |
Mileage End: | 6514 |
Total Mileage: | 92 |
End Date: | 11/28/2009 |
Total Days: | 5 |
Rate Applied: | 24.95 |
Order Status: | Order Completed |
Record | 2 of 3 |
Mileage End: | 2152 |
Total Mileage: | 124 |
End Date: | 11/25/2009 |
Total Days: | 1 |
Rate Applied: | 28.95 |
Order Status: | Order Completed |
Record | 4 of 4 |
Processed By: | 80-485 |
Processed For: | 402-22-9644 |
Start Date: | 01/05/2010 |
Order Status: | Order Reserved |
Record | 5 of 5 |
Processed By: | 80-468 |
Processed For: | 368-36-4838 |
Car Rented: | RBL-618 |
Condition: | Good |
Tank Level: | Empty |
Mileage Start: | 8266 |
Start Date: | 11/30/2009 |
Rate Applied: | 35.95 |
Order Status: | Car On Road |
Notes: | The customer has indicated that he will need the car for a month; that is, until the end of December 2009. The customer wanted to rent a Standard size car but there was none available. Therefore, although the customer is getting an SUV, we will apply the Monthly Standard rate. |
Record | 3 of 5 |
Mileage End: | 10697 |
Total Mileage: | 290 |
End Date: | 11/30/2009 |
Total Days: | 3 |
Rate Applied: | 45.00 |
Order Status: | Order Completed |
Record | 6 of 6 |
Processed By: | 28-485 |
Processed For: | S-738-384-838-784 |
Car Rented: | DCC-713 |
Condition: | Excellent |
Tank Level: | 3/4 Full |
Mileage Start: | 5002 |
Start Date: | 12/02/2009 |
Order Status: | Car On Road |
Record | 5 of 6 |
Mileage End: | 10114 |
Total Mileage: | 1848 |
End Date: | 12/28/2009 |
Total Days: | 28 |
Rate Applied: | 35.95 |
Order Status: | Order Completed |
|
||
Previous | Copyright © 2008-2016, FunctionX, Inc. | Home |
|