MS Access – Controls & Properties

By | September 24, 2022

In this chapter, we will be covering Controls and Properties available in Access. We will also learn how to add controls to forms. Controls are the parts of a form or report that you use to enter, edit, or display data. Controls let you view and work with data in your database application.

  • The most frequently used control is the text box, but other controls include command buttons, labels, check boxes, and subform/subreport controls.
  • There are different kinds and types of controls you can create, but all of which will fall into one of the two categories — bound or unbound.

Bound Controls

Let us now understand what Bound Controls are −

  • Bound controls are ones that are tied to a specific data source within your database such as a field and a table or a query.
  • Values can be either text, dates, number, check boxes, pictures or even graphs.
  • You use bound controls to display values that come from fields in your database.

Unbound Controls

Let us now understand what Unbound Controls are −

  • Unbound controls on the other hand are not tied to a data source, and they exist only in the form itself.
  • These can be text, pictures or shapes such as lines or rectangles.

Control Types

You can create different types of controls in Access. Here, we will discuss a few common ones such as Text box, Label, Button Tab Controls etc.

Text Box

  • Typically, anything that is in a text box will be bound, but not always.
  • You can use these controls to interact with the data stored in your database, but you can also have unbound text boxes.
  • Calculated controls will perform some kind of calculation based on an expression that you write and that data is not stored anywhere in your database.
  • It is calculated on the fly and live just on that one form.

Labels

  • Labels will always be text and unbound.
  • Normally, labels are not connected to any source in your database.
  • Labels are used to label other controls on your form such as text boxes.

Button

  • This is another type of popular control; these command buttons usually perform a macro or module.
  • Buttons are usually used to interact with the data or objects within your database.

Tab Controls

  • Tab controls give you a tabbed view of controls or other controls in your form.
  • Adding tabs to a form can make it more organized and easy to use, especially if the form contains many controls.
  • By placing related controls on separate pages of the tab control, you can reduce clutter and ease your work with data.

Hyperlink

  • Hyperlink creates a hyperlink on your form to something else. It can either be a web page or even another object or place within your database.

Some Other Controls

Let us now look into some other controls −

  • You can also create a web browser control and navigation control, groups, page breaks, combo boxes.
  • You can create charts, lines, toggle buttons, list boxes, rectangles, check boxes, unbound object frames, attachments, option buttons, subforms and subreports, bound object frames and even place images on your form.

Example

Let us now look at a simple example of some of these controls by creating a new blank form. Go to the Create tab in the forms group and click on Blank Form.

Blank Form

The above step will open an unbound form, which is not attached yet to any item in our database.

Field List

By default, it will open in layout view as shown in the above screenshot.

Let us now go to the Design View to add fields.

Add Design Fields

On the Design tab, click on the Property Sheet.

Property Sheet Design

On the Property Sheet, click on the drop-down arrow and make sure Form is selected, and then go to the Data tab.

Details Property

On the Data tab, you will see that the Record Source remains blank. Let us assume, we want to create a form that’s going to be tied to two different tables in our database. Now click on … button. It will further open its own query builder.

Query Builder

Select the tables that contain the data you want to display; click on the Add button and then close this dialog box.

Select Property Sheet

Let us now select all the fields from tblEmployees and drag to query grid, and similarly add all the fields from tblHRData.

Now, click Save As and give this query a name.

Query2 Save

Let us call it qryEmployeesData and click Ok and then close the query builder.

Employee Data

You can now see the query as its Record Source. We have now bound this form to an object in our database, in this case qryEmployeesData. We can now start by adding some controls to this form and to add any one of the controls, go to the Design tab and view your options from the controls group.

Use Control Wizard

From the Controls menu, you will see that the Use Control Wizard is highlighted as in the above screenshot. This little button has that highlighted box around it by default. This means that the control wizards are turned on. This is like a toggle switch. When you click on the toggle switch the wizards turn off. Clicking it again will turn the wizards on.

Let us now click on the Label and drag this label and enter Employee Information and then go to the Format tab to format it as in the following screenshot.

Detail Employee Information

You can choose to apply a bold style or change the font size of text inside that label etc. This control appears inside the detail section of your form. It makes more sense to position this label inside the form header section, which is not visible yet.

Header Section

Right click anywhere in the background of that form and choose Form Header as in the above screenshot.

Form Header

Move this control into the Form Header area. Let us now create some other controls from the Design tab. At this point, Let us say, we want to distribute all our fields into two different tabs.

Header Area

From the control menu, you can see the Tab Control which will create tabs on your form. Click on the tab control and draw it on your form in the detail section as in the above screenshot.

Tab Control

It will create two tabs — page 2 and page 3 as in the above screenshot.

Let us now start by adding some controls to this tab control.

If we want to view some information that’s stored in our underlying query, click on the Add Existing Fields option from the Ribbon in Tools group to view all the available fields from our underlying query.

Existing Fields

To bring the existing fields to the page, select all the fields available in the Field List as in the following screenshot.

Fields Available

Now, drag the fields to Page2 of the tab control as in the following screenshot.

Drag Fields

Now, go the Arrange tab and select the Stacked layout.

Stacked Layout

On the second page, let us now add the remaining fields from this query.

Remaining Fields

You can go through and make any adjustments to the size and width of these controls to get it looking the way you like.

Once you are done with formatting click on the Save As icon to save the form with the name you want.

Save Employee Data

Click Ok and go to the Form view to view all the information in that form.

View Information

The tab control is breaking up our controls or our fields into two screens to make viewing and adding information easier.

Adding Information Easier

Leave a Reply

Your email address will not be published. Required fields are marked *