MS Access - Create Form
Forms in Access are like display cases in stores that make it easier to view or get the items that you want. Since forms are objects through which you or other users can add, edit, or display the data stored in your Access desktop database, the design of your form is an important aspect. There's a lot you can do design-wise with forms in Microsoft Access. You can create two basic types of forms −
- Bound forms
- Unbound forms
Bound Forms
Let us now understand what Bound Forms are −
- Bound forms are connected to some underlying data source such as a table, query, or SQL statement.
- Bound forms are what people typically think of when they think of the purpose of a form.
- Forms are to be filled out or used to enter or edit data in a database.
- Examples of bound forms will typically be what users use to enter, view or edit data in a database.
Unbound Forms
Let us look into Unbound Forms −
- These forms are not connected to an underlying record or data source.
- Unbound forms could be dialog boxes, switch boards, or navigation forms.
- In other words, unbound forms are typically used to navigate or interact with the database at large, as opposed to the data itself.
Types of Bound Forms
There are many types of bound forms you can create in Access. Let us understand the types −
Single Item Form
This is the most popular one and this is where the records are displayed — one record at a time.
Multiple Item Form
This displays multiple records at a time from that bound data source.
Split Form
The form is divided into halves, either vertically or horizontally. One half displays a single item or record, and the other half displays a list or provides a datasheet view of multiple records from the underlying data source.
Creating Forms
There are a few methods you can use to create forms in Access. For this, open your Database and go to the Create tab. In the Forms group, in the upper right-hand corner you will see the Form Wizard button.
Click on that button to launch the Form Wizard.
On this first screen in the wizard, you can select fields that you want to display on your form, and you can choose from fields from more than one table or a query.
Let us assume we want to simply have a quick form that we are going to use for data entry for our employee information.
From Tables/Queries drop-down list, select tblEmployees table. Click on the double arrow to move all the fields at once.
Let us just leave it with that one table, and click Next.
The following screen in the Form Wizard will ask for the layout that we would like for our form. We have columnar, tabular, datasheet and justified layouts. We will choose the columnar layout here and then click Next.
In the following screen, we need to give a title for our form. Let us call it frmEmployees.
Once you have given your form a title, you can open the form to see what that form looks like, or you can begin entering information into your table. Or you can choose the option to modify the form's design. Let us choose the first option to open the form to view or enter information and click Finish.
Now, take a look at the following screenshot. This is what your form looks like. This is a single item form, meaning one record is displayed at a time and further down you can see the navigation buttons, which is telling us that this is displaying the record 1 of 9. If you click on that button then, it will move to the next record.
If you want to jump to the very last record in that form or that table, you can use the button right beside that right arrow, the arrow with a line after it, that's the last record button. If you want to add new employee information, go to the end of this records and then after 9 records you will see a blank form where you can begin entering out the new employee's information.
This is one example of how you can create a form using the Form Wizard. Let us now close this form and go to the Create tab. Now we will create a slightly more complicated form using Wizard. Click the Form Wizard and this time, we will choose fields from a couple of different tables.
In this Form Wizard, let us choose tblProjects for Tables/Queries, and select a few Available Fields such as ProjectID, ProjectName, ProjectStart, and ProjectEnd. These fields will now move to Selected Fields.
Now select tblTasks for Tables/Queries and send over the TaskID, ProjectID, TaskTitle, StartDate, DueDate and PercentComplete. Click Next.
Here, we want to retrieve data from a couple of different objects. We can also choose from options on how we want to arrange our form. If we want to create a flat form, we can choose to arrange by tblTasks, which will create that single form, with all the fields laid out in flat view as shown above.
However, if we want to create a hierarchical form based on that one-to-many relationship, we can choose to arrange our data by tblProjects.
In the above window, we have the option to include a subform for tblTasks, or we can make that a linked form. This linked form is where tblProjects will have a button that will launch that second form filtered to the project that we have selected in that underlying projects form. Let us now select the Form with subform(s), and then click Next.
In the following screen, you can choose a layout for your subform. The Datasheet View gets selected by default. The Datasheet View is similar to Table View. Now, click Next.
In the following screen, you need to provide a name for your forms. Enter the name you want and click Finish.
Access will give you a preview of what your form looks like. On top, you have the controls on your main form, which is from our Projects table. As you go down, you will see a subform. It's like a form within a form.
Multiple Item Form
You may also want to create a specific kind of form. For this, you can click on the More Forms drop-down menu.
From the menu, you can create a Multiple Items form, a Datasheet form, a Split form, or even a Modal Dialog form. These are typically bound forms; select the object that you would like to be bound to that form. This does not apply to the Modal Dialog forms.
To create this type of form, you will need to select the object in navigation pane first. Let us select tblEmployees here.
Proceed by clicking on More Forms and Multiple Items.
The above step will further create a Multiple Items form, listing out all the employees.
Split Form
This type of form is divided in equal halves, either vertically or horizontally. One half displays a single item or record, and the other half displays a list or a datasheet view of multiple records from the underlying data source.
Let us now select tblEmployees in the navigation pane and then on Create tab. Select Split Form option from More Forms menu and you will see the following form in which the form is divided vertically.