Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Microsoft Access 2019 Tutorial #2

INFO 123 Hands-on Tutorials


Microsoft Access for Windows (Tutorial #2)

This tutorial uses the same ‘Winter’ database from Tutorial 1. Please ensure your database matches the
one from Learn before beginning this Tutorial.

Learning Objectives:
• Using a form to modify a record
• Delete records using a form
• Sorting records
• Customising an input form

Task 1 - Modifying & Deleting Records


You may find that many of the records you create are incorrect due to a typo or people may leave and
request to be removed from the database. Follow the exercises below to learn how to modify or delete a
record.

1.1 - Modify a Record


➢ Using the All Access Objects pane, navigate to and open your Customer Form from last
week.

➢ To modify data in a field, click the text box you wish to modify and use your keyboard
to edit the data.
➢ Edit John Dokes Address to 15 Elm St.

This method can be used to modify any data in your table.

1
Microsoft Access 2019 Tutorial #2

1.2 - Delete a Record


➢ Navigate to record 6 (Charlie Brown).
➢ In the Home Tab of the ribbon, navigate to the
Records Section and click the arrow beside
Delete. Click Delete Record and click Yes to
confirm.
We have just removed Charlie Brown from the database. You cannot reverse this change.
NOTE: Access does not ‘reuse’ AutoNumber numbers. When you delete a record, the AutoNumber for
that record is deleted and will not be used again. In our example, record 6 will never be created again.
The next CustID will be 7 rather than 6.

1.3 - Sorting Records


A form determines how your data is displayed, but not its order. By default, they are sorted by the
primary key. You will notice that your Customer table is sorted by CustID. Below, we will sort our
customers by Last Name.
➢ Click in the last name field. In the Home Tab, click on the Sort Ascending icon to sort
your records.

Task 2 - Customising a Form


Last week we used to Form Wizard to create a data input form. This method was quick and easy, but
does not provide us with a way to customise the layout of the form. This exercise below will guide you
through modifying a form to mirror a professional, paper based form.
Below we will use the Form Design view which allows us to re-position fields using the mouse, add
borders to the form, change colour or text on the form and enable combo boxes to improve data entry.
➢ Ensure you have the Customer form open you created in the last tutorial.
➢ Under the Home Tab, click the View button and select
Design View. The Customer Form will be displayed in
Design View (Shown below).
➢ Under the Form Design Tools, Design section of the
ribbon, select Add Existing Fields to display the Field
List for your form.

2
Microsoft Access 2019 Tutorial #2

Use the Formatting tools on


Click here to toggle the Font group to change
between views (e.g. Design fonts, font size, align text,
view, Form view) etc. Click to display the Field List

Field List: Use drag and drop to


Text Box
select fields from the CUSTOMER
table and add them to your form.
.

Label

Use Rulers to help align


labels, text boxes etc.

Labels and Text Boxes (Definition)


• A Label is used to display text on a form. You can edit labels to change what
the user of the form will be presented with.
• A Text Box in Access is different to other Microsoft programs. In Access, a
Text Box is used for text input on a form. You do not need to edit the text
in a text box while designing a form.
The below information is useful for understanding the different options available for form design. Read
through these before moving onto the exercise below (Task 2.1). If you are stuck with how to proceed
through the exercise, the information below will be helpful.

Moving Labels and Text Boxes


By default, a label is connected to a text box. If you try to move either, they will all move together as
they are joined. However, we want to move the labels and text boxes individually.
➢ Select the CustID label. You will see a small black square appear above the top left of the label,
which can use to move the label.
You can use this method for moving text boxes as well.

Deleting a Text Box or Label


To delete a text box or label, select the item and press Delete on the keyboard.

3
Microsoft Access 2019 Tutorial #2

Formatting Text Boxes or Labels


To format a text box or label, you need to select the Format Tab to display the Font Group. This will
display a number of formatting options that can be used to customise the appearance of text within boxes
or labels.
Click on the
Format Tab
to display the
Font group

Adding Labels or Text Boxes


To add a label or text box to a form, select the Label button from the Controls section in the ribbon.

You will then be able to use your mouse to draw a label on the form. This allows you to create headers
or new labels as you need.

Adding Lines and Rectangles


You can enhance the appearance of your form by adding lines to create sections, group related fields or
emphasise titles or text.
To insert a line - select the line option from the Controls section of the ribbon (where we inserted a
label earlier). Position your pointer in the place where you want to insert a line. While holding your
mouse button down, drag the pointed to create the line that you want.

To adjust the position of the line, you can use your mouse to drag and drop. When you click on the
line, a set of squares should appear around the border. Click and drag this square to move the line.
The same method can be used to add a rectangle to your form from the Controls group.

Changing the Size of Text Box or Label


You can change the size of a text box or label using the Size/Space options on the Ribbon of the Arrange
Tab. For example:
• To Fit sizes the box relative to its content
• To Grid adjusts the position of the text box to the nearest gridline
4
Microsoft Access 2019 Tutorial #2

2.1 - Practicing with Forms


Use the image below to modify your Customer form using the methods described on the previous page.
Follow the image below for a design idea.

2.2 - Adding a List Box


You may find yourself repeatedly entering the same or similar value for all customers. In our case, we
are only entering 1 of 4 options for Credit Rating. To save time, we will replace the text box with a
combo box.
➢ Begin this exercise by deleting your current Credit Rating label and Text Box. These are
linked, so by deleting both we are starting fresh.
➢ Select List Box from the Controls section of the ribbon.
➢ Use your mouse to draw the area where you would like
your Combo Box to be shown on your from.
When you release your mouse, you will be shown the Combo Box
Wizard. This is where you will enter the details for your list box.
➢ Ensure ‘I will type in the values that I want’ is selected and click Next.
At the next screen, you need to enter the values you want to see in your list box.
➢ Enter the values shown in the image to the right and click Next.

5
Microsoft Access 2019 Tutorial #2

➢ At the next screen select ‘Store


that value in this field:’ and
choose Credit Rating from the
drop-down list. Click Next.

➢ At the final screen, give your


combo box a label: Credit
Rating. Click Finish.

➢ Resize your Combo Box to match


the other controls on the form.
Make sure it is correctly
formatted.

➢ Use your new form to add your own details to the database similar to the image shown
below.

6
Microsoft Access 2019 Tutorial #2

2.3 - Modifying Tab Index


A useful feature of Access is the Tab key while you are entering data. If you place your cursor in the
FirstName textbox and press Tab you will be moved to the LastName textbox. This increases the speed
for entering data when you use your form.
However, when you create or insert new controls (combo box, text box etc), Access is unable to
understand the order of the textboxes. You must manually tell Access what order the Tab key should
move through the text boxes. The order which Access moves through controls is called the Tab Index.
Try tabbing through your form and you may notice that the Credit Rating combo box comes after the
Balance. Follow the exercise below to fix this.

➢ Ensure your Customer form is open in Design


View.

➢ Select your credit rating combo box and navigate


to the Property Sheet on the right of your screen.
If you cannot see this, right click on the combo
box and select properties.

➢ Click the Other tab and you will see an option Tab Index. Change this from 8 to 7.

➢ Access will automatically update any controls following the one you have updated. Check
that Balance has updated to 8.

➢ Open your form in Form View and try tabbing through again. You should see that the
order is now correct.

Task 3 - Sales Form

➢ Using the skills, you have practiced, create a form similar to the one shown below to enter
new sales.

➢ Add sales for the following:

• Customer 1 purchased 10 of
product 1 on the 8/01/2015

• Customer 2 purchased 10 of
product 1 on the 10/01/2015

• Customer 4 purchased 50 of
product 2 on the 01/02/2015

• Customer 4 purchased 5 of
product 1 on the 05/02/2015

Extra Resources
➢ More details on creating an Access form can be found here.

You might also like