|
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
|
|
- Start Microsoft Access and, from the resources that accompany our lessons,
open the Bethesda Car Rental1 database
- In the Navigation Pane, under Customers: Table, double-click Customers1 to
open it:

- After viewing it, close it
- Again, in the Navigation Pane, right-click Customers1 and click Design
View
- In the Controls section of the
Ribbon, click the Insert or Remove Page Break button
and, on the form, position the mouse in the Details section at 21/4
of the vertical ruler

- Then click
- Once again, in the Controls section of the Ribbon, click the Insert or Remove Page Break button
and, on the form, click in the Details section at 4.5 of the vertical ruler

- While still in the Design View, reduce the height of the form so that the
Work Phone label appears in half

- In the Controls section of the Ribbon, make sure the Use Control Wizard
button is not clicked
.
Click the Command Button and click the Form Footer section of the form
- Add two more buttons and change their properties as follows:
 |
| Button Name |
Caption |
| cmdContact |
Contact |
| cmdPersonal |
Personal Information |
| cmdComments |
Comments |
|
- To create a macro, right-click the Contact button and click Build
Events...
- In the Choose Builder
dialog box, double-click Macro Builder

- In the Action combo box, select GoToPage
- In the bottom section of the window, click Page Number and type 1
- Close the macro window
- When asked whether you want to save, click Yes
- On the form, right-
click the Personal Information button and click Build Events...
- In the Choose Builder
dialog box, click Macro Builder and click OK
- In the Action combo box, select GoToPage
- In the lower section of the window, click Page Number and type 2 and close
the macro window
- When asked whether you want to save, click Yes
- On the form, right-
click the Comments button and click Build Events...
- In the Choose Builder
dialog box, double- click Macro Builder
- In the Action combo box, select GoToPage
- In the lower section of the window, click Page Number and type 3 and close
the macro window
- When asked whether you want to save, click Yes
- Save the form and switch it to Form View
- Click the buttons to test the functionality
- Close the form
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:
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
|
|
- The Bethesda Car Rental1 database should still be opened.
In the Navigation Pane, under Customers: Table, double-click Customers2 to
open it, then switch it to Design View
- In the Controls
section of the Ribbon, click the Tab Control
and position the mouse in the top-left side of the Detail section of the form

- Then click
- To add a new tab, right-click the tab control and click Insert Page
- Double-click the middle of the first tab page to access its Properties
window
- Change the Caption property to Contact
- Click the middle tab page and, in the Properties window, change its
Caption to Driving Information
- Click the right tab page and, in the Properties window, change its Caption
to Notes/Comments
- Using the Existing Fields window, complete the design of the form by
adding the controls
- Save the form and close it
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
|
|
- Open the Video Collection3 database you created in the
previous lesson. If you
did not create it, from the resources that accompany these lessons,
open the Video Collection3a database
- On the Ribbon, click Create
- In the Forms section, click More Forms -> Form Wizard.
If you receive a Microsoft Office Access Security Notice, read it and
click Open
- In the Tables/Queries combo box, select Table: Directors
- Click the Select All button
- In the Tables/Queries combo box, select Table: Videos
- Double-click the following fields to select them: Title,
CopyrightYear, Length, and Rating

- Click Next
- In the second page, click by Directors (or make sure it
is selected) and click Next

- In the 3rd page, click the Tabular radio button

- Click Next
- In the 4th page, click the Module style and click Next
- In the 5th page of the wizard, accept the name of (main) form as
Directors.
Change the name of the subform to sbfVideos

- Click Finish
- After viewing the form, close it
|
Subforms and Subreport Design |
|
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:
- You can create a form using the Form Wizard, then design a separate
subform and add it to the form
- You can create both the form and its subform using the Form Wizard, then
modify the design
- You can design both the form and the subform separately, then join them
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.
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
|
|
- Open the Music Collection3 database
- To create a new form, on the Ribbon, click Create and, in the Forms
section, click Form Design
- Access the Properties window for the form and set its Record Source
to
AlbumTracks
- Save the form as sbfTracks
- Reduce the width of the form so its right border is at 23/8
- If the Field List is not displaying, on the Ribbon, click Design
and, in the Tools section, click Field List
.
In the Field List, click TrackNumber. Press and hold Shift. Then click TrackLength and release Shift. This selects the TrackNumber, the TrackTitle, and the TrackLength fields
- Click and drag the selected fields to the Detail section of the form. There is no need to change the positions or locations of the labels and text
boxes
- lick each label twice (not double-click; simply click it once and click it again) to put it into edit mode and then delete the colon “:” on the right side of each
string
- Click the TrackNumber text box and, on the Ribbon, click the Right
button
:
-
Double-click the button at the intersection of both rulers. In the Properties window, click Format and change the following properties:
DefaultView: Datasheet
Record Selectors: No
Navigation Buttons: No
Dividing Lines: No
-
To switch the form to Datasheet View, on the Ribbon, click the arrow of the View
button and click Datasheet View
-
Right-click the # column header and click Column Width... Type 3.85 and press Enter
-
Right-click the Track Title column header and click Column Width… Type 24.75 and press Enter
-
Right-click the Length column header and click Column Width… Type 7.85 and press Enter
-
Save and close the subform
-
In the Navigation Pane, double-click MusicAlbums: Table form to open it
-
After viewing it, switch it to Design View and click the Tracks tab on the tab control
-
In the Controls section of the Ribbon, click the Use Control Wizard button
-
To add the new subform, in the Controls section of the Ribbon, click the Subform/Subreport button
-
Click the body of the Tracks tab on the form

If you receive a Microsoft Office Access Security Notice, read it and click Open
-
In the first page of the Subform/Subreport Wizard, in the list of forms, click sbfTracks
and click Next
-
In the second page of the wizard, make sure the Choose From A List radio button is selected. Also, in the Select One Of These Links list box, make sure the relationship is based on the AlbumID field.
Click Next
-
Accept the suggested name of the subform as sbfTracks and click Finish
-
Click the label that was added to the subform and press Delete (to remove the label). You
may also need to move the subform and resize the tab sheet
-
Save and preview the form
-
Close the 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
|
|
- Open the Ceil Inn3 database you started in Lesson
28 and continued
in the previous lesson. If you did not create create it, from the
resources that accompany our lessons, open the Ceil Inn4 database
- To create a new query, on the Ribbon, click Create and, in the Other
section, click Query Design
- In the Tables tab of the Show Table dialog box, double-click
Customers, Occupancies, and Rooms
- On the Show Table dialog box, click Close
- In the lists of fields, from the Occupancies list, double-click
DateOccupied
- In the Rooms, double-click RoomNumber
- In the Occupancies list, double-click RateApplied, PhoneUse, and
InternetFee
- In the Customers list, double-click CustomerID

- Save the query as CustomerRoomUse and close it
- To create a new form, on the Ribbon, click Create and, in the Forms
section, click Form Design
- Using the Properties window, set its Record Source to
CustomerRoomUse and click OK
- Save the form as sbfCustomerRoomUse
- Change the following properties:
Default View: Continuous Forms
Record Selector: No
Navigation Buttons: No
- Right-click the form and click Form Header/Footer
- In the Controls section of the Ribbon, click the Label

- Click just under the Form Header bar on the left side:

- Type Date Occupied and press Enter
- If the same way, add labels with the captions Room #, Rate Applied,
Phone Use, and Internet Use
- Design and apply a font available to you. Here is an example:

- To display the Field List, on the Ribbon, click Add Existing Fields
- From the Field List, drag DateOccupied and drop it somewhere in the Detail section. Click its label to select it and press Delete to remove it
- In the same way, add the other fields
- Align them next to each other under their corresponding labels.
Design them as you see fit under the Part label but in the Detail section

- In the Controls section of the Ribbon, click the Text Box
and click under the Form Footer
- Using the Properties window, change its characteristics as follows:
Name: txtTotalRateApplied
Control Source: =Sum(RateApplied)
Format: Fixed
- Add another text box to the form footer section, change its
characteristics as follows:
Name: txtTotalPhoneUse
Control Source: =Sum(PhoneUse)
Format: Fixed
- Add another text box to the form footer section, change its
characteristics as follows:
Name: txtTotalInternetFee and its
Control Source: =Sum(InternetFee)
Format: Fixed

- Click the Form Footer bar and, in the All tab of the Properties
window, set its Visible value to No
- Save, preview and close the form
- In the Navigation Pane, under Customers: Table, double-click
Customers and, after viewing the form, switch it to Design View
- In the Navigation Pane, in the Customers section, drag
sbfCustomerRoomUse and drop it on the form under the other control
- Add four text boxes under the subform and design them as follows:
 |
| Label's Caption |
Text Box Name |
Format |
Control Source |
| Phone Use: |
txtPhoneUse |
Fixed |
=[sbfCustomerRoomUse].[Form]![txtTotalPhoneUse] |
| Internet Use: |
txtInternetUse |
Fixed |
=[sbfCustomerRoomUse].[Form]![txtTotalInternetFee] |
| Rate Total: |
txtRateTotal |
Fixed |
=[sbfCustomerRoomUse].[Form]![txtTotalRateApplied] |
| Net Pay: |
txtNetPay |
Fixed |
=Nz([txtPhoneUse])+NZ([txtInternetUse])+Nz([txtRateTotal]) |
|
- Save and preview the form:
- Close the 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
|
|
-
Open the Bethesda Car Rental2 database you created
in Lesson 30 and continued in the previous lesson
-
To create a new form, on the Ribbon, click Create and, in the Forms section,
click Form Design
-
Save the form as sbfCustomers
-
Using the Properties window, set the following characteristics:
Record Source: Customers
Scroll Bars: Neither
Record Selectors: No
Navigation Buttons: No
-
On the Ribbon, click Add Existing Fields
-
Design the form as follows:
-
Save, preview, and close the subform
-
To create a new form, on the Ribbon, click Create and, in the Forms section,
click Form Desig n
-
Save the form as sbfCars
-
In the Properties window, click Record Source and click its ellipsis button
-
In the Show Table dialog box, double-click Cars and Categories
-
Click Close
-
In the list of fields, double-click CarID, TagNumber, Make, Model, CarYear, and
Category (from the Categories table)
-
Close the Query Builder
-
When asked whether you want to save, click Yes
-
Using the Properties window, set the following characteristics:
Scroll Bars: Neither
Record Selectors: No
Navigation Buttons: No
-
On the Ribbon, click Add Existing Fields
-
Design the form as follows:
-
Save, preview, and close the subform
- On the Ribbon, click Create and, in the Forms section, click Form
Design
- Save the form as RentalOrders and change the following characteristics in
the Properties window:
Record Source: RentalOrders
Caption: Bethesda Car Rental - Rental Orders
- On the Ribbon, click Add Existing Fields
- From the Fields List, drag RentalOrderID and drop it in the Detail
section of the form
- In the Controls section of the Ribbon,
make sure the Use Control Wizard button is highlighted. Click Combo
Box and click the Detail section of the form
- In the first page of the wizard, make sure the first radio button is
selected and click Next

- In the second page of the wizard, click Table: Employees

- Click Next
- In the Available Fields list of the third page, double-click
EmployeeNumber, LastName, and Title

- Click Next
- In the fourth page of the wizard, click the arrow of the Ascending
combo box and select EmployeeNumber

- Click Next
- In the fifth page of the wizard, review the list and click Next

- In the sixth page of the wizard, click the arrow of the combo box
and select EmployeeID

- Click Next
- Accept the default label and click Finish
- Using the Properties window, change the caption of the label to Processed
By:
- Click the combo box. In the Properties window, change its Name to
cbxEmployeeID
- Click the Data tab, click Row Source, and click its ellipsis button
- Change the third column name to Employee Name: [LastName] & ", " & [FirstName]

- Close the Query Builder
- When asked whether you want to save, click Yes
- While the combo box is still selected, in the Properties window,
change the following characteristics:
Column Widths: 0";0.85";1.3";1.75"
List Width: 3.9"
- In the Controls section of the Ribbon, make sure the Use Control
Wizard button is highlighted. Click Combo Box and click the Detail
section of the form
- In the first page of the wizard, make sure the first radio button is
selected and click Next
- In the second page of the wizard, double-click Table: Customers and
click Next
- In the Available Fields list of the third page, double-click
DrvLicNumber and FullName
- Click Next
- In the fourth page of the wizard, accept the default and click Next
- In the fifth page of the wizard, review the list and click Next
- In the sixth page of the wizard, click the arrow of the combo box
and select CustomerID
- Click Next
- Accept the default label and click Finish
- Using the Properties window, change the caption of the label to Processed
For:
- Click the combo box. In the Properties window, change the following
characteristics:
Name: cbxCustomerID
Column Widths: 0";1.35";1.5"
List Width: 2.85
- In the Controls section of the Ribbon, click Subform/Subreport
and click the form under the previously added combo box.
If you receive a Microsoft Office Access Security Notice, read it and
click Open
- In the first page of the wizard, in the list, click sbfCustomers and
click Next
- In the second page of the wizard, make sure it indicated that the
tables are connected through the CustomerID field and click Next
- Accept the suggestions of the third page and click Finish
- In the Controls section of the Ribbon, make sure the Use Control
Wizard button is highlighted. Click Combo Box and click the Detail
section of the form
- In the first page of the wizard, make sure the first radio button is
selected and click Next
- In the second page of the wizard, double-click Table: Cars and click
Next
- In the Available Fields list of the third page, double-click
TagNumber, Make, and Model
- Click Next
- In the fourth page of the wizard, accept the default and click Next
- In the fifth page of the wizard, review the list and click Next
- In the sixth page of the wizard, click the arrow of the combo box
and select CarID
- Click Next
- Accept the default label and click Finish
- Using the Properties window, change the caption of the label to Car
Rented:
- Click the combo box. In the Properties window, change the following
characteristics:
Name: cbxCarID
Column Widths: 0";0.75";0.85";1.55"
List Width: 3.15"
- In the Controls section of the Ribbon, click Subform/Subreport
and click the form under the previously added combo box
- In the first page of the wizard, in the list, click sbfCars and
click Next
- In the second page of the wizard, make sure it indicated that the
tables are connected through the CarID field and click Next
- Accept the suggestions of the third page and click Finish
- Using the Fields List, add the other controls
- Add additional text boxes and set their characteristics as follows:
 |
| Label's Caption |
Text Box Name |
Format |
Control Source |
| Sub-Total: |
txtSubTotal |
Fixed |
=Nz([RateApplied])*Nz([TotalDays]) |
| Tax Amount: |
txtTaxAmount |
Fixed |
=CLng(Nz([txtSubTotal])*Nz([TaxRate])*100)/100 |
| Rent Total: |
txtRentTotal |
Fixed |
=Nz([txtSubTotal])+Nz([txtTaxAmount]) |
|
- Save the form and switch it to Form View
- Close the form
- Close the database
- Open the Yugo National Bank2 database
- Start a form in Design View and whose source is the Transactions
table. Create it as a continuous form that includes the
TransactionTypeID, the TransactionDate, the TransactionNumber, the
DepositAmount, the WithdrawalAmount, and the ServiceCharge columns.
Save the form as sbfTransactions. Configure to not allow data entry
and not to show the navigation buttons
- In the Form Footer section, add a text box with the following
characteristics:
Name: txtDeposits
Control Source: =Sum([DepositAmount])
Format: $# ##0,00;($# ##0,00)
- Still in the Form Footer section, add another text box with
the following characteristics:
Name: txtWithdrawals
Control Source: =Sum([WithdrawalAmount])
Format: $# ##0,00;($# ##0,00)
- Once again in the Form Footer section, add another text box with
the following characteristics:
Name: txtServiceCharge
Control Source: =Sum([ServiceCharge])
Format: $# ##0,00;($# ##0,00)
- Use the Visible property to hide the text boxes in the Form Footer
section
- Start a new form in Design View and whose source is the Customers
table. Include the EmployeeID, the DateCreated, the AccountNumber, the
AccountType, and the CustomerName fields. Save the form as
CustomersTransactions. Configure to not allow data entry
- Use the Subform/Subreport button and the Control Wizard button of
the Ribbon to add the sbfTransactions sub-form to the form
- In the Form Footer section, add a text box with the following
characteristics:
Name: txtDeposits
Control Source: =Sum([DepositAmount])
Format: $# ##0,00;($# ##0,00)
- Still in the Form Footer section, add another text box with
the following characteristics:
Name: txtWithdrawals
Control Source: =Sum([WithdrawalAmount])
Format: $# ##0,00;($# ##0,00)
- Once again in the Form Footer section, add another text box with
the following characteristics:
Name: txtServiceCharge
Control Source: =Sum([ServiceCharge])
Format: $# ##0,00;($# ##0,00)
- Design the form as you see fit. Here is an example:

- Close the form
|
|