- MS Access - Data Export
- MS Access - Data Import
- MS Access - Macros
- MS Access - Built-In Functions
- MS Access - Formatting Reports
- MS Access - Reports Basics
- MS Access - Controls & Properties
- MS Access - Formatting
- MS Access - SQL View
- MS Access - Combo Box
- MS Access - Navigation Form
- MS Access - Modify A Form
- MS Access - Create A Form
- Unmatched Query Wizard
- MS Access - Duplicate Query Wizard
- MS Access - Joins
- MS Access - Summarizing Data
- MS Access - Grouping Data
- MS Access - Indexing
- MS Access - Calculated Expression
- MS Access - Wildcards
- Many-To-Many Relationship
- One-To-Many Relationship
- One-To-One Relationship
- MS Access - Create Relationships
- MS Access - Relating Data
- MS Access - Alternate Criteria
- MS Access - Parameter Queries
- MS Access - Create Queries
- MS Access - Action Queries
- MS Access - Query Criteria
- MS Access - Query Data
- MS Access - Adding Data
- MS Access - Create Tables
- MS Access - Data Types
- MS Access - Create Database
- MS Access - Objects
- MS Access - RDBMS
- MS Access - Overview
- MS Access - Home
MS Access Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
MS Access - Controls & Properties
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 apppcation.
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 pnes 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 pve 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.
Hyperpnk
Hyperpnk creates a hyperpnk 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, pnes, toggle buttons, pst 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 cpck on Blank Form.
The above step will open an unbound form, which is not attached yet to any item in our database.
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.
On the Design tab, cpck on the Property Sheet.
On the Property Sheet, cpck on the drop-down arrow and make sure Form is selected, and then go to the Data tab.
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 cpck on … button. It will further open its own query builder.
Select the tables that contain the data you want to display; cpck on the Add button and then close this dialog box.
Let us now select all the fields from tblEmployees and drag to query grid, and similarly add all the fields from tblHRData.
Now, cpck Save As and give this query a name.
Let us call it qryEmployeesData and cpck Ok and then close the query builder.
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.
From the Controls menu, you will see that the Use Control Wizard is highpghted as in the above screenshot. This pttle button has that highpghted box around it by default. This means that the control wizards are turned on. This is pke a toggle switch. When you cpck on the toggle switch the wizards turn off. Cpcking it again will turn the wizards on.
Let us now cpck 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.
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.
Right cpck anywhere in the background of that form and choose Form Header as in the above screenshot.
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.
From the control menu, you can see the Tab Control which will create tabs on your form. Cpck on the tab control and draw it on your form in the detail section as in the above screenshot.
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, cpck on the Add Existing Fields option from the Ribbon in Tools group to view all the available fields from our underlying query.
To bring the existing fields to the page, select all the fields available in the Field List as in the following screenshot.
Now, drag the fields to Page2 of the tab control as in the following screenshot.
Now, go the Arrange tab and select the Stacked layout.
On the second page, let us now add the remaining fields from this query.
You can go through and make any adjustments to the size and width of these controls to get it looking the way you pke.
Once you are done with formatting cpck on the Save As icon to save the form with the name you want.
Cpck Ok and go to the Form view to view all the information in that form.
The tab control is breaking up our controls or our fields into two screens to make viewing and adding information easier.
Advertisements