Anda di halaman 1dari 175

Happy Computers Manual for...

Microsoft Access 2007


Advanced
This course guide is produced for the Happy Computers Access 2007 Advanced course
For all your computer training needs contact:
Happy Computers, Cityside House, 40 Adler Street, London, E1 1EE
Help-line: 020 7375 7373 help_line@happy.co.uk
Bookings: 020 7375 7300
Copies of this guide can be obtained from Happy Computers, fully bound, at a cost of 15 each, or 10
for extra copies for organisations who have booked courses.
Happy Computers allows this guide to be copied, provided that permission is sought and the name and
phone number of Happy Computers remains on the copies.

Happy Computers 2012- 11/08/12 V1

Microsoft Access 2007 - Contents

Contents
Contents ............................................................................... 2
Happy Computers Telephone Help-Line .......................... 4
Relational database design ................................................ 5
Relational databases ..................................................................................................... 5
Linking tables and keys ................................................................................................. 8
What do relationships look like in Access terms? .......................................................... 9
What do you need to create a relationship? ................................................................ 10
Creating a relationship ................................................................................................. 11
What might go wrong when setting up a relationship? ................................................ 14
Amending relationships between tables ...................................................................... 17
Choosing what to display in the relationship window................................................... 19
Printing out your relationships ..................................................................................... 21
Queries based on more than one table ....................................................................... 22

The hierarchy of an access database ............................. 24


The hierarchy of an access database ...................................................................... 24

Main and sub forms using queries .................................. 25


Main and sub forms using queries ............................................................................... 25
Creating a main and sub form for a many to many relationship .................................. 26
Using a main and sub form .......................................................................................... 40
Adding a total to a sub form ......................................................................................... 41

Useful controls on forms .................................................. 44


Controls on forms ........................................................................................................ 44
Creating a combo box.................................................................................................. 45
Creating a combo box based on another table ............................................................ 47
Limit the choices in a combo box................................................................................. 52
Combo boxes using more than one field ..................................................................... 53
What can go wrong when creating a combo box? ....................................................... 59
Combo boxes to find records ..................................................................................... 60
Command buttons ....................................................................................................... 68
Command buttons using the wizard ............................................................................ 70
A command button to view the same record between two forms ................................ 73
Stopping a secondary form from maximising............................................................... 77
Editing a form for data entry only ................................................................................. 79

Tab Controls ...................................................................... 81


Tab controls ................................................................................................................. 81
Creating Tab Controls from a blank form..................................................................... 82
Adding new pages ....................................................................................................... 86
Changing page names................................................................................................. 87
Moving pages .............................................................................................................. 89
Moving & resizing tab controls ..................................................................................... 90
Changing the style ....................................................................................................... 91

Macros ................................................................................ 94
Creating macros .......................................................................................................... 94
What does a macro window look like?......................................................................... 95
Planning which macros you need ................................................................................ 96
Creating macros .......................................................................................................... 96

Page 2

Happy Computers 020 7375 7300

Microsoft Access 2007 - Contents


Creating macro groups ................................................................................................ 98
Macros and command buttons .................................................................................. 100
Macros and forms...................................................................................................... 102
Some useful macros .............................................................................................. 103
Another useful macro ................................................................................................ 114

Combining controls and objects ................................... 119


Combining controls and objects ................................................................................ 119
A report that selects its criteria from a drop down list!............................................... 121
A report that selects its criteria from two text boxes! ................................................. 134
Improving the look of forms ....................................................................................... 145

Creating a user interface ................................................ 148


Creating a user interface ........................................................................................... 148
Opening your database at the opening screen ......................................................... 161

Making things tidy........................................................... 163


Compact & Repair ..................................................................................................... 163
Data separation ......................................................................................................... 163
Setting a password for your database ....................................................................... 169
Creating a back-up of your database ........................................................................ 172

Index ................................................................................. 174

Happy Computers 020 7375 7300

Page 3

Microsoft Access 2007 - Happy Computers Telephone Help-Line

Happy Computers Telephone HelpLine


We want to hear from you. The aim of our courses is to leave delegates confident in
using the software. If you have difficulty with any aspect of what you covered on the
course, we want to know about it and we want to help you through it. It is a guarantee
of the quality of our training, so we dont extend it to anyone else in your organisation
who has not been trained by us. (Though ring us if you would like to arrange cover for
holidays or sickness)
For two years from the day of your course you will be
able to use the helpline free of charge, even if you
have changed jobs since doing the course.

You can contact us if you have a


question that relates to the course
you did with Happy Computers

The help-line hours are 9.30am - 5.00pm

(Sorry its not a General


Helpline).

020 7375 7373


help_line@happy.co.uk

We do our best but we dont


guarantee instant answers please
see the table below for our target
call resolution times.

Access, VBA and web courses: please note: we will do what we can to help but we
cannot carryout debugging or redesign work.
This is a category C course
Category A
Category B
Category C
Category D
Category E

90% solved within one hour


90% solved within four hours
90% solved within 24 hours
90% solved within 2 working days
One special trainer only 90% solved within 2 working days unless the
trainer is on holiday/sick

Category F

90% solved within 5 working days

If your question goes beyond the level of the course you attended it is up to the
discretion of the Helpline person whether they answer it. We will always try to point you
to another source of help if this is the case.

We want you to contact us


Your help-line questions also help us. We find out how you use the software, the
problems you hit, and sometimes, bugs we dont know about. All this helps to improve
our courses and our service. So please keep those calls coming. If you have difficulty
getting through please contact Henry Stewart, Chief Executive of Happy Computers, on
his personal mobile number (07870 682442) or you can email him at the following
address: henry@happy.co.uk

Page 4

Happy Computers 020 7375 7300

Microsoft Access 2007 - Relational database design

Relational database design


Relational databases
What is a relational database?
A relational database is simply the technical term for a database whereby:

Information is stored in several tables, which are linked together!

In fact, very few databases (if they are designed correctly) hold all their information in
just one table!

Why have information in different tables?


Information is held in more than one table to:

Avoid keying in the same information twice


Make it easier to extract information

Consider this example:


You have a database holding information on staff and their training:

This design is reasonable as long as each staff member only goes on one training
course,
However, what happens when a staff member needs further training, see Debbie
Anderson
You could repeat the Training fields, and this certainly seems to work for Debbie:

However, where will you search for attendance of an Access Essentials course? It
could be in any of the Training field columns!

Happy Computers 020 7375 7300

Page 5

Microsoft Access 2007 - Relational database design


One solution: a one to many relationship
You divide the database into two tables; you hold the staff information in one table and
the training information in another table.
This design allows you to hold many days training against each one member of staff:
This is called a One to Many relationship.

ONE member of staff can go on MANY training days:

to

MANY

Another solution: a many to many relationship


However, what happens when one member of staff needs to go on many training
courses, but one course has many members of staff on it!
You divide the database into three tables:

You hold the staff information in one table (as before)


You hold the training information in a second table (as before)
You hold the linking information in a third table an EXTRA table
(The linking table often (although not always) represents something. In our
example it represents a booking, the training actually attended.)

This design allows you to hold many days training against each one member of staff
and many members of staff against each one training course:
ONE training course can
This is called a Many to Many relationship.
have MANY members of
ONE member of staff can go on
MANY training days:

Page 6

staff on it:

Happy Computers 020 7375 7300

Microsoft Access 2007 - Relational database design


It is actually made up of two One to Many relationships with the same table (the linking
table) in the middle.

1
1

to

Happy Computers 020 7375 7300

MANY

MANY

to

Page 7

Microsoft Access 2007 - Relational database design

Linking tables and keys


The Primary Key
What is the Primary Key?
It is a special field that uniquely identifies each record in the table
If you are creating a relationship between two tables then you must have a
Primary Key in the one side of a one to many relationship
This same field also needs to be present in the many end of the relationship, here it is
called the Foreign Key:

The Foreign Key


What is the Foreign Key?
It is the linking field in the many end of a one to many relationship
It links directly to the Primary Key in the one end of the relationship

What keys do I need in a Many to Many relationship?


The two main tables
The two main tables should each have a primary key. It is these
fields that connect them to the linking table.
The linking table
The linking table holds the two Foreign Keys which link to both of the main
tables.
It is also good practice for the linking table to have a Primary Key of its own.
Which field should be my Primary Key in the linking table?

It is usually most straightforward to use another ID field, e.g.


AttendanceID for this and make it an Autonumber.
However, in some cases you may prefer to create a
compound primary key based on your 2 foreign keys. You
should only use this method if you can be certain that the
combination of your 2 foreign keys will never be duplicated.
(If in doubt it is better to use a separate ID field).

Page 8

Happy Computers 020 7375 7300

Microsoft Access 2007 - Relational database design

What do relationships look like in Access terms?


Example of a one to many relationship

The Foreign
key

The Primary
key (has a
small key next
to it)

Example of a many to many relationship


In fact you just create TWO one to many relationships with the same table (the linking
table) in the middle:

The two
Foreign Keys

The Primary
Key

The Primary
Key

Why do you need the Course Date in the linking table?


A particular employee is going on a course on a particular date.
This date does not apply to just the person or just the course.
It relates to the link between both the employee and the course.
In our example it would be referred to as the booking or the training
actually attended.

Happy Computers 020 7375 7300

Page 9

Microsoft Access 2007 - Relational database design

What do you need to create a relationship?


What do you need to create a relationship between two tables?
The one side
A table with a field defined as the Primary Key
The many side
A second table with a field that has the same data type as the Primary Key field
in the first table, this is called the Foreign Key

What data type do I need for my Foreign Key?

if your Primary Key data type is

then your Foreign Key data type must be

Text

Text

Autonumber

Number (with the Field Size = Long


Integer)

Number

Number (with the Field Size = to the


Primary Key Field Size)

What does a Field Size = Long Integer mean?


This is set in Design view of a table, in the Field Properties section:

Long Integer means:


A long whole number (no decimal places).

Page 10

Happy Computers 020 7375 7300

Microsoft Access 2007 - Relational database design

Creating a relationship
Do I need to do anything different if I want to create a Many to Many
relationship?
No. A Many to Many relationship is actually made up of two One to
Many relationships with the same table (the linking table) in the middle:

Creating a relationship between two tables


Make sure all tables, queries etc are Closed
1. Click on Database Tools tab
2. Click on the Relationships button

I cannot see the table you need to create your relationship

1. Click on the Show Table button


2. Double-click on the Table(s) you want to work with
3. Click on the Close button

3. Click and Drag the Primary Key


field (in the ONE side of the
relationship) to the matching field
in the other table
4. Click on Enforce Referential
Integrity

Happy Computers 020 7375 7300

See next page for further info on this

Page 11

Microsoft Access 2007 - Relational database design

5. Click on Cascade Update Related


Fields
6. Click OK

The relationship between your two tables


has now been created and automatically
saved
Repeat Steps 1 to 5 as necessary, to
create further one to many relationships.

What will it look like?

The
Primary key

The
Foreign key

What is referential integrity?


Referential integrity helps ensure:

That the relationship between records remains valid


That you don't accidentally delete related data

Helping to ensure that the relationship between records remains


valid
This means that if your Employees ID numbers range from 1 to 100, then your Training
Reference to these Employees must also be within the 1 to 100 range.
For example, in the tables below I cannot key in a new Training Course for Employee
number 126, because there is no Employee with that number.

Page 12

Happy Computers 020 7375 7300

Microsoft Access 2007 - Relational database design

MANY

1
to

Avoiding accidentally deleting related data


When you enforce referential integrity you cant delete a record from the ONE side of a
relationship if there are related records in the MANY side!
For example, in a relationship between employees and their training you cant delete an
employee from the employee table because then you would have training courses that
didnt belong to anybody. (The exception to this is if you turn on Cascade Delete - see
over the page for an explanation.)

What does cascade update mean?


If you select the Cascade Update option, any time you change the Primary Key of a
record in the ONE side, Access automatically changes the Foreign Key to the new value
in all related records in the MANY side.
For example, if you change an Employee ID in the Employees table, the Employee ID
field in the Training table is automatically updated for all of that employees training so
that the relationship isn't broken.
Access will update all related records without displaying any message.

What does cascade delete mean?


If you select the Cascade Delete option, any time you delete a record in the ONE side,
Access automatically deletes all the related records in the MANY side.
For example, if you delete an employee record from the Employees table, all the
employees training courses are automatically deleted from the Training table.
Access does warn you that related records would also be deleted.

Closing the relationship window


1. Click the Close button on the
relationships window
2. Message appears

Happy Computers 020 7375 7300

Page 13

Microsoft Access 2007 - Relational database design

3. Click Yes
Do I need to save?
It is your choice
You are being prompted to save the LAYOUT of the relationships
window, not the actual relationship the relationship between two tables
is saved as soon as you create it.

What might go wrong when setting up a


relationship?
Why does the edit relationships dialogue box want me to set up a ONE to
ONE relationship?

Whoops!
This
indicates
that you are
trying to link
two primary
keys

In a One to Many relationship, only one field should be a primary key whilst the other
one should be a foreign key.
You need to correct this in the following way
1. Close down the Relationships
window
2. Click on
- if prompted to
Save the Layout changes
3. Open the MANY side table in

Page 14

For example,

Happy Computers 020 7375 7300

Microsoft Access 2007 - Relational database design


Design view

4. Change the Primary key to the


correct field
5. Close down the Table window
6. Click Yes to save changes
7. Click on the Database Tools tab
8. Click on the Relationships button
9. Click and Drag the Primary Key
field (in the ONE side of the
relationship) to the matching field
in the other table
10. Click on Referential Integrity
11. Click on Cascade Update Related
Fields
12. Click Create

What can I do if I forgot to set Enforce referential integrity?

Whoops! This
should really look
like this

You need to edit the relationship options


1. Double-click on the line between
the two tables

2. Click on Referential Integrity

Happy Computers 020 7375 7300

Page 15

Microsoft Access 2007 - Relational database design


3. Click on Cascade Update Related
Fields
4. Click OK

What does this error message mean?


When you try to link the primary
key and the foreign key, you will
get this message if the data
types of these fields arent
compatible!

What data type do I need for my foreign key?


if your Primary Key data type is

then your Foreign Key data type must be

Text

Text

Autonumber

Number (with the Field Size = Long


Integer)

Number

Number (with the Field Size = to the


Primary Key Field Size)

1. Close down the Relationships


window
2. Click on
- if prompted to
Save the Layout changes
3. Open the MANY side table in
Design view
4. Change the Data Type of the
Linking field to the correct one
5. Check the Field Properties of the
Linking field and amend as
necessary
6. Click Ctrl + S
7. Close the table
8. Click on the Relationships button
9. Click and Drag the Primary Key
field (in the ONE side of the
relationship) to the matching field
in the other table
10. Click on Referential Integrity
11. Click on Cascade Update Related
Fields
12. Click Create

Page 16

Happy Computers 020 7375 7300

Microsoft Access 2007 - Relational database design

Amending relationships between tables


Amending the options in a relationship
You may want to go back into the relationship between two tables to amend the options.
1. Double-click on the line between
the two tables

2. Change the options as


necessary

For example: You


might want to
temporarily turn on
Cascade Delete, so
you can delete
some
old/expired/out of
date records

3. Click OK

Deleting a relationship
If you want to permanently delete the relationship between two tables
1. Right-click on the line between the
two tables

Happy Computers 020 7375 7300

Page 17

Microsoft Access 2007 - Relational database design

2. Choose Delete
3. Click Yes

Page 18

Happy Computers 020 7375 7300

Microsoft Access 2007 - Relational database design

Choosing what to display in the relationship


window
Removing a table from the display
If you have set up lots of relationships in your database, then the relationships window
can get rather cluttered.
1. Click on the Table to be deleted

2. Press Delete
3. Close the Relationship window

For example, you can delete


tblLookupGender

Message appears

4. Click Yes

If I delete the table, am I deleting the relationship or link between


the tables?
No, as long as you only select the table before you press Delete, then
only the table will be deleted.

Happy Computers 020 7375 7300

Page 19

Microsoft Access 2007 - Relational database design

Showing relationships that arent seen in the display


If youve deleted some tables from view, or you want to check that you are seeing ALL
of the relationships in your window.
Click on the Show All Relationships
button

Page 20

Happy Computers 020 7375 7300

Microsoft Access 2007 - Relational database design

Printing out your relationships


You can now print a Relationship Report, which will show all relationships in your
database.

Printing your Relationship Report


1. Open the Relationships window
2. Click on the Relationship Report
button

Report will be generated

3. Click on the Print button

4.
5.
6.
7.

Click OK
Close the Report window
Click Yes
Type in a name that clearly
describes the report
8. Click OK

Happy Computers 020 7375 7300

You will be prompted to save the report


For example
rptRelationshipsForEmployees

Page 21

Microsoft Access 2007 - Relational database design

Queries based on more than one table


What if my information is stored in more than one table?
If your information is stored in more than one table, then you need to add ALL of the
tables that hold the information you need to extract.

Creating a query based on more than one table


1. Click on the Create tab
2. Click on the Query Design button

3. Double-click on the Tables you want


to use
Your three tables are
automatically linked,
because you have
created a relationship
between them

4. Click Close
5. Double-click on the fields to include in
the query

Add any criteria if required and choose


which fields you want to Sort on if
required

6. Click on the Run button

7. If you want to add more fields, click on the View button to return to
Design view
8. Make your changes
9. Click on the Run button again
10. Click Ctrl + S
11. Type a name that clearly describes
the query

Page 22

Happy Computers 020 7375 7300

Microsoft Access 2007 - Relational database design

What should I call my query?


When saving a query it is good practice to identify it as a query in the
name.
For example:

It is also good practice not to leave spaces and to capitalise the first
letter of each word.
12. Click OK

Closing a query
Click on the cross in the top right
corner of the screen

Happy Computers 020 7375 7300

Page 23

Microsoft Access 2007 - The hierarchy of an access database

The hierarchy of an access database


The hierarchy of an access database
How does it all fit together?

You have to create a table first


A query is based on a table
A form can be based on either a table or a query
A report can be based on either a table or a query

QUERY

You might want to draw


some lines between the
Access objects, so that
you know what can be
based on what

TABLE

FORM
REPORT

Page 24

Happy Computers 020 7375 7300

Microsoft Access 2007 - Main and sub forms using queries

Main and sub forms using queries


Main and sub forms using queries
When your tables are linked in a MANY to MANY relationship, for example:

You will need to create a special form to bring together the three tables that are linked,
this will help you enter your information in a more user friendly way.
This form is called a Main and Sub form.

What is a main and sub form?


In a Many to Many relationship, you will probably want to create TWO Main and Sub
forms, so that you can represent the relationship visually from both sides:
This form visually represents the Employee
information with their Training Courses:

This form visually represents the Training


Course information with the Employee
attendance:

Both these forms are made up of a Main form and a Sub form, in each example:

The Main form represents the ONE side


The Sub form represents the MANY side

What benefits do I gain by creating a main and sub form?


Main and Sub forms provide an essential way to key in information when you have three
(or more) tables linked in a Many to Many relationship:

You can view the information from both sides simultaneously


You can edit the information in both sides simultaneously
You can add new information to both sides simultaneously

Happy Computers 020 7375 7300

Page 25

Microsoft Access 2007 - Main and sub forms using queries

Creating a main and sub form for a many to


many relationship
Summary of the 3 steps
Creating a Main and Sub form for one side of a Many to Many relationship has three
main steps:

Creating a Main form


Creating a Query to base the Sub form on
Creating a Sub form

Why do I need to create a query before I can create the sub form?
The only way that you can create a sub form for a many to many
relationship is to create a query, which combines the compound primary
key (the fields in the linking table) with the other information you want
visible on the sub form!
Lets consider our example of a many to many relationship:

MAIN AND SUB

The Sub form is based on a


query which combines
information from the table
called tblTainingAttended and
tblTraining CourseDetails this represents the MANY
side in this relationship
(the query MUST include the
Compound Primary Key
fields from the linking table)

The Main
form is
based on
the table
called
tblEmployee
this
represents
the ONE

Step 1 - Creating a main form (using the wizard)


1. Click on the Create tab
2. Within the Forms group, click on the More Forms button

3. Choose Form Wizard

Page 26

Form Wizard dialog box appears

Happy Computers 020 7375 7300

Microsoft Access 2007 - Main and sub forms using queries

4. Choose the table (or query) to


base the form on
5. Double-click the Fields you want

For example, tblEmployee

6. Click Next
7. Choose a Layout for the main form

8. Click Next
9. Choose a Style for your Form

Happy Computers 020 7375 7300

Page 27

Microsoft Access 2007 - Main and sub forms using queries

10. Click Next


11. Type a title for the Main form

12. Click Finish

Page 28

For example:
mainfrmEmployee&TrainingCourseInfo

A form is created

Happy Computers 020 7375 7300

Microsoft Access 2007 - Main and sub forms using queries

Step 2 - Creating a Query to base the Sub form on


1. Click on the Create tab
2. Click on the Query Design button

3. Select the tables you want to add

In this example we will be using 2 tables

In our example
we want the
linking table and
one of the tables
at the Many end
of the
relationship

4. Click Close
This is the
Linking table

This is the table at the


Many end of the
relationship

5. Double-click on the fields to


include in the query
What MUST you include in your query?
The two Foreign Key fields from the Linking table
EmployeeId andCourseID

Add more fields to your query grid

Happy Computers 020 7375 7300

Page 29

Microsoft Access 2007 - Main and sub forms using queries

6. Click on Run

7. Click Ctrl + S
8. Type a name that clearly describes
the query
9. Click OK
10. Close the query

Check you are extracting the information


you want

For example,
qryTrainingCourseInfoForSubForm

Stage 3 Creating a sub form (on a main form)


1. Double-click the main form on the left side

2. Click on the Home tab if youre not there


already
3. Click on the View button

4. Choose Design View


5. Click on the Maximise button
6. Make some space in the lower half of your
form
Click and Drag down here

7. Within the Controls group, click on


the Subform/Subreport button
8. Click on your Main form (where
you created the extra space)

Page 30

Subform Wizard opens

Happy Computers 020 7375 7300

Microsoft Access 2007 - Main and sub forms using queries

9. Make sure this option is checked

10. Click Next

11. Select the Query to base your form


on
12. Double-click on the Available
Fields, to Select the fields you
want
What MUST you include in your query?
The two Foreign Key fields from the Linking table
EmployeeId andCourseID

Happy Computers 020 7375 7300

Page 31

Microsoft Access 2007 - Main and sub forms using queries

Why do I need to select both fields?


Even though the Employee ID field already exists in your Main form, if
you do not include it in your Sub form at this stage Access will not be
able to create the link that is needed for the Main and Sub form to work.
We just include it now, and then hide it later.

13. Click Next

14. Click Next


15. Type a name that clearly describes
the query
16. Click Finish
17. Maximise your form

Page 32

You do not have to change anything here

For example, subfrmTrainingCourseInfo

Your form will look something like this

Happy Computers 020 7375 7300

Microsoft Access 2007 - Main and sub forms using queries

What does a main and sub form look like in design view?
This is how your Sub form might look in Design view:

Click Ctrl + S

Switching to form view of the main form


1. Click on the View button

2. Choose Form View

Happy Computers 020 7375 7300

Page 33

Microsoft Access 2007 - Main and sub forms using queries

Switching back to design view of a main and sub form


1. Click on the View button

2. Choose Design View

Resizing the column widths in a sub form


Having adjusted the actual size of the sub form, you may need to also adjust the column
widths to make it easier to use:

1. Ensure you are in Form View of the


Main and Sub forms
2. Place your mouse pointer between the
column headings
3. Double-click to automatically resize
each column

4. Repeat the steps for each column


width you want to resize

5. Click Ctrl + S

Changing the size of the sub form


When you have created your new Sub form, the size of it may need adjusting. For
example it may need to be bigger so that all the information is displayed instantly
without you having to use the scroll bars:

Page 34

Happy Computers 020 7375 7300

Microsoft Access 2007 - Main and sub forms using queries

1. Ensure you are in the


Design View of the Main
and Sub forms

2. Click on the Sub form to


select it

Handles (small squares) appear

3. Click and Drag on a Size


handle where you want to
change the size
What should my mouse look like?
Your mouse will look like a double-headed arrow
when you resize a control or label.
4. Click Ctrl + S to save the
changes

Happy Computers 020 7375 7300

Page 35

Microsoft Access 2007 - Main and sub forms using queries

Changing the default view of a sub form


The default layout of a Sub form is datasheet view:

However, you can change it so that you see just one record at a time:

1. Open the Main form in Design view


2. Double-click the Sub form to select
it, by clicking here

You should have a black square in this


box, if the form is Selected

3. Click on the Property Sheet button

4. Change Default View to Continuous


Forms
5. Click on the cross to close the
Property Sheet

Page 36

Happy Computers 020 7375 7300

Microsoft Access 2007 - Main and sub forms using queries


6. Click Ctrl + S
7. Click on the View button

You will switch to Form view

Hiding the repeated field in the main and sub form


When you have created your Main and Sub form, you will want to hide the field in the
Sub form that already appears in the Main form:

Repeated
field

1. Open the Main and sub form in Design view


2. Select both parts of the field you want to hide in the
Sub form by clicking to the left of the field (see below)

The selected fields will look like


this

3. Click on the Property Sheet button

4. Change Visible to No

5. Click on the cross to close the Property Sheet

Happy Computers 020 7375 7300

Page 37

Microsoft Access 2007 - Main and sub forms using queries

6. Click on the View button

You will not see the fields

I can still see the field in Design View?


Yes, you will, but you can reduce the size of the fields so they are less
visible
1. Select the fields as before
2. Click on any corner of the field and drag upwards, the cursor will
be a double-headed arrow
From this
To this

7. Click Ctrl + S

Moving the fields in the sub form


If your sub form is in continuous forms view and you have deleted a field, you may need
to move your fields about to improve the look of your form:

This is where the


repeated fields
were

1. Open the Main and sub form in Design


view
2. Select both parts of the fields in the Form
Header and Detail area by clicking and
dragging with a black arrow

Page 38

Happy Computers 020 7375 7300

Microsoft Access 2007 - Main and sub forms using queries

3. Click and Drag on the border area of part


of the selection to move the fields up
4. Position the cursor on the select table
symbol
5. Click and drag upwards
6. Click Ctrl + S

All the selected fields will move up

Changing the label of a sub form


You may prefer the text above (or next to) your Sub form, to be more descriptive than
the name that you save the Sub form under you can easily change this:

1. Open the Main and sub form in Design


view
2. Click on the Label of the Sub form to
select it

3.
4.
5.
6.

Click and Drag over the text already there


Type in the new piece of text
Press Enter
Click Ctrl + S

Happy Computers 020 7375 7300

For example, Training Information

Page 39

Microsoft Access 2007 - Main and sub forms using queries

Using a main and sub form


Opening a main and sub form
Which form do I open?
Always open the Main form this holds ALL the information from any
linked forms.

Within the Navigation bar on the left,


double-click the Main form

The different parts of a main and sub form


A label
A field

Record
navigation
buttons for the
Main form

Record
navigation
buttons for the
Sub form

Closing a main and sub form


Click the Close button on the Main form
window

Page 40

Happy Computers 020 7375 7300

Microsoft Access 2007 - Main and sub forms using queries

Adding a total to a sub form


Why add a total to a sub form
Consider this example: In our sub form we can see all the courses that an employee
has sat on. Wouldnt it be nice to know the total cost of all the courses they have
attended?

Adding a total to a Sub form

This field
adds up all
of the prices
in the sub
form

This only works if your sub form is in Continuous view.

Happy Computers 020 7375 7300

Page 41

Microsoft Access 2007 - Main and sub forms using queries


1. Open the sub form in Design view

2. You may need to make the sub form


bigger so you can see the Form Footer
3. Make some space in the Footer

The Totals field will appear here


Click and drag the
bottom edge of
the footer

4. Click on the Add Existing Fields button

All the existing fields on this form


appears

5. Click and drag the field that you would like


to total, onto your Footer area

For example, Price

6. Click into the Control to edit your field (the


right hand side of the field)

7. Type the following =sum([name of the


field])

8. Click into the Label and type an

Page 42

For example, Total cost of courses

Happy Computers 020 7375 7300

Microsoft Access 2007 - Main and sub forms using queries


appropriate description
9. Select the Control

10. Click on the Property Sheet button

11. In the Format tab change the Format to


Currency

12. Click Ctrl + S


13. Close the sub form
14. Open the Main form to see the Totals for
all the courses

Format your Total so that it stands out from the other data
Select the Control and Label and click on the Properties button
Click on the Format tab
Make changes as appropriate

Happy Computers 020 7375 7300

Page 43

Microsoft Access 2007 - Useful controls on forms

Useful controls on forms


Controls on forms
What is a control?
Control is the name for Objects that exist on a form.
For example:

Fields
Sub Forms
Combo Boxes
Command Buttons, etc

What benefit do I gain by creating controls?


This combo
box allows me
to find any
record in my
form

This
Command
Button
allows me to
open
another form
and view the
salary
information
of only the
record I am
viewing

This Combo Box


allows me to view
more than one field,
when I want to choose
a new record for my
sub form

Page 44

This Command
Button allows me to
print only the record I
am viewing

Happy Computers 020 7375 7300

Microsoft Access 2007 - Useful controls on forms

Creating a combo box


What is a combo box?

A list of pre-defined entries to choose from, when typing information into a form:

What is the difference between a combo box and a lookup?


Nothing, the only difference is that in a table it is referred to as a lookup and in a form it
is referred to as a combo box!
Lookup in a table - Note: You
only see the arrow for the drop
down list when your cursor is
actually sitting in the lookup
field

Combo on a form Note: The arrow for


the drop down list
is always visible

What benefit do I gain by creating a combo box?


A combo box allows you to ensure that when you type in data it is done so consistently
and accurately, because you choose your information from a pre-typed list:

For example, to ensure that only valid entries are actually keyed into a
department field, you would create a combo box that holds the correct entries
to choose from.

Happy Computers 020 7375 7300

Page 45

Microsoft Access 2007 - Useful controls on forms

How many ways are there to create a combo box in your form?
There are two ways to create a combo box:

Creating a combo box based on another table and then using the wizard to link
everything
Creating a combo box solely using the wizard

Why create a combo box based on another table?


Creating a combo box in this way will give you much more flexibility
when you need to amend, add or delete any of the entries in the list to
choose from.

Page 46

Happy Computers 020 7375 7300

Microsoft Access 2007 - Useful controls on forms

Creating a combo box based on another table


Summary of the 2 steps
Creating a Combo Box based on another table has two main steps:
Create and save a new table to hold your choices
Create the combo box on a form

Step 1 Create and save a new table to hold your choices


1. Click on the Create tab
2. Click on the Table Design button

3. Create one field with a text data type

4. Set the Indexed field property to Yes (No


Duplicates)

5. Click Ctrl + S
6. Type a name that clearly describes the
table
7. Click OK

8. Click No
9. Click on the View button

This will automatically sort your


list into alphabetical order

For example,
tblLookupDepartment
Access will let you know there is
Primary key for this table and that
you can create one now. A lookup
table doesnt need a Primary key
Will take you to Design view

10. Type in your list of information

11. Close the table

Happy Computers 020 7375 7300

Page 47

Microsoft Access 2007 - Useful controls on forms

Step 2 - Create the combo box on a form


1. Double-click on the Form you want to
open
2. Click on the View button
3. Choose Design
4. Click on the Maximise button

For example,
mainfrmEmployee&TrainingCourseInfo

5. Make some space on your form(where


do you want the combo box)
Or
Delete the field you are going to
replace with a Combo box if it is
already displayed on your form (this is
the one we are going to do)

6. Click on the Combo Box button


7. Click on your Form

(in the controls group)


Where you want your Combo Box to
appear dont worry if it doesnt fit
neatly into the Layout

8. Make sure the first choice is selected

9. Click on
10. Choose the Table to base your Combo
Box on

11. Click on
12. Double click on the available field to

Page 48

Happy Computers 020 7375 7300

Microsoft Access 2007 - Useful controls on forms


select it

13. Click on
14. You can now choose the sort order for
the Combo Box

(if required)

15. Click on
16. To increase the column width of the
Combo Box place mouse pointer on
the edge and double click

17. Click on
18. Choose Store that value in this field
and select the correct field

19. Click on
20. Type an appropriate Label for your
combo box

Happy Computers 020 7375 7300

Page 49

Microsoft Access 2007 - Useful controls on forms

21. Click on
A Combo box will be created for you at this point you are seeing it in Design View

To make it fit neatly into the layout move it slightly with its move handle until it snap fits:

What if my Combo Box has Unbound written in the right hand


side?

You have made a mistake, and your Combo box will not work properly!
See the page on What can go wrong when creating a Combo Box.
22. Click on the Save button

(to save the Combo Box in the Form)

Using a combo box


In Form View:
1. Click on the
arrow to display
the list

2. Click on the
information
you want to
enter

Page 50

Happy Computers 020 7375 7300

Microsoft Access 2007 - Useful controls on forms

Remind me, what was the benefit of creating a combo box?

Consistent information typed into a form


Accurate information typed into a form

Question:
Will Access let you key in information then, that isnt in the list?
Answer:
Yes!
The solution:
If you want to ensure absolute consistency when inputting information into a combo box,
then you need to amend one of the fields property settings:

Change the Limit To List Property to YES

Happy Computers 020 7375 7300

Page 51

Microsoft Access 2007 - Useful controls on forms

Limit the choices in a combo box


The EXTRA STEP when creating a combo box
How do I ensure my combo box works to keep the input consistent?
If you want to ensure absolute consistency when inputting information into a combo box,
then you need to amend one of the fields property settings:

Change the Limit To List Property to YES

Limiting the choices in a combo box


1. Open the form with the combo box
in Design view
2. Click into your Combo Box (to
select it)
3. Click on the Property Sheet button
in the Tools group

4. Click the Data tab and amend the


Limit to List property to yes

5. Close the Property Sheet pane


Click here
to Close

6. Ctrl + S to save

Page 52

Happy Computers 020 7375 7300

Microsoft Access 2007 - Useful controls on forms

Combo boxes using more than one field


What benefit do I gain by using more than one field?
When entering in Course details at the moment we need to know the Course ID.
However, it would be much easier to add a new course record if we could see the
Course Type as well as the ID.

Here we can
choose a
Course by
its Type

Summary of the 2 steps


Creating a Combo Box using more than one field has two main steps:

Delete the field you are going to replace with a Combo Box
Create the Combo Box on your form

Step 1 Delete the field you are going to replace with a combo box
1. In Design view of the form
2. Click on the field you are going to replace
with a Combo Box to select it
3. Press DELETE

Step 2 Create the combo box on your form


1. Click on the Combo Box button
2. Click on your Form

(in the controls group)


Where you want your Combo Box to
appear dont worry if it doesnt fit
neatly into the Layout

3. Make sure the first choice is selected

Happy Computers 020 7375 7300

Page 53

Microsoft Access 2007 - Useful controls on forms

4. Click on
5. Choose the Table to base your Combo
Box on

6. Click on
7. Double click on the fields you want to
see in the Combo Box to select them

8. Click on
9. You can now choose the sort order for
the Combo Box

Choose the ID field and another that


identifies the record to the user

(if required)

10. Click on
11. Click the Hide Key Column OFF
12. To increase the column width of the
Combo Box place mouse pointer on

Page 54

Happy Computers 020 7375 7300

Microsoft Access 2007 - Useful controls on forms


the edge and double click

13. Click on
14. Select the field that uniquely identifies
each record in your table

15. Choose Store that value in this field


and select the correct field

16. Click on
17. Type an appropriate Label for your
combo box

18. Click on
A Combo box will be created for you at this point you are seeing it in Design View

To make it fit neatly into the layout move it slightly with its move handle until it snap fits:

Happy Computers 020 7375 7300

Page 55

Microsoft Access 2007 - Useful controls on forms

19. Click on the Save button

(to save the Combo Box in the Form)

This is how your Combo Box might look in Form View:

Click on
the
downward
arrow to
display
the list

Amending the column Widths of you combo box


Once you have created your Combo Box, you may decide that the column widths still
need to be altered slightly so that you can clearly see all the information you need to:

1. Open the form with the combo box in Design


View
2. Click into your Combo Box to select it
3. Click on the Property Sheet button and
choose the format tab

Page 56

Happy Computers 020 7375 7300

Microsoft Access 2007 - Useful controls on forms

4. Amend the column widths appropriately and


ensure the List Width is the sum of the
column widths

5. Close the property Sheet window


6. Ctrl + S to save

7. Click on View
Before amending column widths:

After amending column widths:

Happy Computers 020 7375 7300

Page 57

Microsoft Access 2007 - Useful controls on forms

How do I change the alignment of my list?


1. Open the form in Design view
2. Select the Combo Box

3. Click on Property Sheet


4. In the Format Tab change Text Align to Left

Go to Form view, the list should now look like this:

Page 58

Happy Computers 020 7375 7300

Microsoft Access 2007 - Useful controls on forms

What can go wrong when creating a combo box?


My combo box is unbound
If your Combo Box says Unbound in the right hand side (in Design view), you have
made a mistake, and your Combo box will not work properly!

Instead, it should look something like this


1. In the design view of the form click on the
combo box to select it

2. Click on the property sheet button

3. Click into the Control Source area

4. Choose the correct field from the list

5. Close the Property Sheet pane


6. Ctrl + S to Save

Happy Computers 020 7375 7300

Page 59

Microsoft Access 2007 - Useful controls on forms

Combo boxes to find records


What benefit do I gain by creating a combo box to find records?
One of the most frequent things you will do in your form is to find and view a particular
record:

You could use the Find button

But the
drawback here
is you have to
know what you
are looking for
and type it in!

Wouldnt it be easier if you could just choose the record you want to view from a list?

Summary of the 2 steps


Creating a Combo Box to find records has two main steps:

Page 60

Create some space on your form


Create the Combo Box on your form

Happy Computers 020 7375 7300

Microsoft Access 2007 - Useful controls on forms

Step 1 Create some space on your form


1. In the design view of your form

2. Make some space in the Form Header area


of your form

Click and Drag down here

Step 2 - Create the combo box on your form

1. Click on the Combo Box button


2. Click on the form where you want the combo to
appear
3. A wizard starts. Make sure this choice is selected

4. Click on
5. Double-click on the fields which will help you
identify your records

Happy Computers 020 7375 7300

Page 61

Microsoft Access 2007 - Useful controls on forms

6. Click on
7. To increase or decrease the column widths of the
Combo Box,
place your mouse pointer at the edge of the
headings in turn and Double-click)

8. Click on
9. Type an appropriate label for your combo box

10. Click on
11. Ctrl + S to save

Improving the look of your combo box


When you have created your Combo Box, the layout may need amending:

The text in
the Label is
not fully
visible

1. In the design view of the form click on the


control to select it

Page 62

Happy Computers 020 7375 7300

Microsoft Access 2007 - Useful controls on forms

3. Ctrl + S
2. Click and Drag on the large
black square to move the
Control

What if I dont want to see the persons name once I have chosen to
find them?
For example, instead of seeing this information once you have chosen to find
Becky:

You could instead choose this layout whereby only the arrow is visible:

To do this:
In Design View of the form, resize the Control so that only the arrow is
visible!

Using your combo box to find records


1. Click on the
arrow to display
the list

In Form view:

2. Click on the
record you want
to find

Happy Computers 020 7375 7300

Page 63

Microsoft Access 2007 - Useful controls on forms

How can I make the list in my Combo Box appear in alphabetical


order?
Make sure that the table or query your actual form is based on, is sorted
alphabetically!

Making your Combo Box show the full name


Once your Combo Box is created you may wish to edit it so that it displays full names:

1. In the design view of the form click on the


control to select it

2. Click on the Property Sheet button


3. Scroll down to Row Source on the Data tab
and click it
4. Click the Build button

Page 64

Happy Computers 020 7375 7300

Microsoft Access 2007 - Useful controls on forms

5. Select the FirstName field


6. Press Delete
7. Click into the Sort row in the LastName
column
8. Choose Ascending from the drop down list

9. Click on the tick in the Show row in the


LastName column to hide it

10. In the Field row of a blank column type:


Full Name:[Firstname]& &[Lastname]
11. Select the new field you have created
12. Click and Drag your new field so that it is
positioned before the Department field

13. Click on Run to preview your list


14. Close your query.
15. Click on
16. Ctrl + S

Happy Computers 020 7375 7300

Page 65

Microsoft Access 2007 - Useful controls on forms

Making your Combo Box update when you move between records
You may find that if you use your Record Navigation buttons to move between records
that your Combo Box will not match the record you are looking at e.g.

In order to get the Combo Box to update we need to use some VBA code.
1. In the design view of the form click on the control
to select it

2. Click on the Property Sheet button


3. Make a note of your Combo Box Name

4. Select your form


You should have a black box
on the top left-hand corner if
your form is selected

5. In the Properties box click on the Event tab

6. Click on the Build button

Page 66

next to the On

Happy Computers 020 7375 7300

Microsoft Access 2007 - Useful controls on forms


Current event

7. Click on Code Builder


8. Click on OK (The VBA Window will open up)

9. Where your cursor is type:

10. Ctrl + S to
11. Close the VBA window

Happy Computers 020 7375 7300

Page 67

Microsoft Access 2007 - Useful controls on forms

Command buttons
Why create command buttons?
Command buttons allow you to automate your forms.
You can attach actions to the buttons and tell Access what you want to happen after the
button has been clicked.
For example:

Open another form


Print a record
Run a query
Go to the first or last record, etc

How many ways are there to create a command button?


There are two main ways to create command buttons:

Creating a command button solely using the Wizard


Creating a command button and then attaching Macros to it
(see the section on Creating macros for command buttons)

What benefit do I gain by attaching a Macro to create a command


button, rather than using the Command Button Wizard to create
them?
Generally speaking, if you are creating lots of forms with the same
command buttons, it is quicker and easier to create the first set and then
copy and paste them elsewhere.
If you have used the Command Button Wizard to create your buttons
you cannot do this they wont work when they have been pasted!

Page 68

Happy Computers 020 7375 7300

Microsoft Access 2007 - Useful controls on forms

What are the different format choices?

Command button
displaying text

Command button
displaying a picture

Should you use text or pictures on your buttons?


Text is much more descriptive than a picture, which will need
interpreting!

Does it matter where I place the buttons on a form?


No, although it is worth spending time planning out how many you need
and whether each form will hold similar buttons
For example, if you want each form to have one of these
,
it makes sense to make sure they are in the same place on each form!

Happy Computers 020 7375 7300

Page 69

Microsoft Access 2007 - Useful controls on forms

Command buttons using the wizard


If you use the wizard, you have a wide range of choices that you can get your button to
do.
Different actions are available for each category:
Record Navigation:

Form Operations:

Application:

Page 70

Record Operations:

Report Operations:

Miscellaneous:

Happy Computers 020 7375 7300

Microsoft Access 2007 - Useful controls on forms

Creating a command button using the wizard


In our example, we are creating a Command button to Print the current record in a
Form:
1. In Design view of the form ensure the Use Control
Wizards button in the controls group is selected

2. Click on the Button button in the controls group

3. Click on your form (where you want the Command


Button to appear)
4. Select the Category and Action you want when the
wizard starts

We have
selected
the Record
Operations
category

If the wizard didnt start


Use Control Wizards is
not turned on

and, the
Print
Record
action

5. Click on

6. Click on the Text choice, and amend the text


(if you want to)

7. Click on
8. Type an appropriate name for your button
will not be displayed)

Happy Computers 020 7375 7300

If you type & in front of


one of the letters, then this
button can be accessed by
pressing Alt and that letter
as a keyboard shortcut!

(this

Page 71

Microsoft Access 2007 - Useful controls on forms

9. Click on
10. A Command Button will be created for you at this
point you will see it in Design View

11. Ctrl + S to save


Now try out your button in Form View

Page 72

Happy Computers 020 7375 7300

Microsoft Access 2007 - Useful controls on forms

A command button to view the same record


between two forms
What is the benefit of creating a command button to view the same record
between two forms?
Working with long forms
If you are working with a long form, it is easier for the person typing
information in, if you break it down into small forms.
These small forms can then be linked together using Command Buttons.
How do the forms link together?
You must remember to include the primary key field in each form; this
then becomes the linking field!
For example:
Whilst working in a form holding employee and training information, I dont necessarily
need to view their salary details but it might be helpful to have quick access to it, just in
case!

One Click
on this
button,
and the
salary
info for
this
employee
is
displayed
here!

Happy Computers 020 7375 7300

Page 73

Microsoft Access 2007 - Useful controls on forms

Creating a command button to view the same record between two forms
1. In Design view of the form ensure the Use Control Wizards button in
the controls group is selected

2. Click on the Button button in the controls group

3. Click on your form (where you want the Command Button to appear)
4. Select the Form Operations Category and
the Open Form Action

5. Click on
6. Select the Form you want to open
(which Form do you want to open when you Click on your button)

Page 74

Happy Computers 020 7375 7300

Microsoft Access 2007 - Useful controls on forms

7. Click on
8. Make sure the first choice is selected

9. Click on
10. Click on the Linking fields in each form, Click on the

button

(the two fields are usually the Primary Key fields in each Form)

11. Click on
12. Click on the Text choice, and amend the text

13. Click on
14. Type an appropriate name for your button

Happy Computers 020 7375 7300

(if you want to)

(this will not be displayed)

Page 75

Microsoft Access 2007 - Useful controls on forms

15. Click on
16. Ctrl + S to save
17. Now try out your button in Form View

When you
Click on the
Command
Button, the
Form with
just that
persons
information
in it, opens
up!

Sandys
information
is displayed
in both
Forms, at the
Click of a
button!

Working with linked forms


Once you have linked two (or more) Forms via a Command Button, you
might also want to add a button to Close the Forms after you have
finished with them!

What if my Main form is maximised, but I dont want the form that
opens off it to be maximised?
To prevent this happening, you need to amend one of the form property
settings on the second form:

Page 76

Change the Pop Up Property to YES

Happy Computers 020 7375 7300

Microsoft Access 2007 - Useful controls on forms

Stopping a secondary form from maximising


The EXTRA step when creating a command button to view the same
record between two forms
How do I ensure that the secondary form opening off a first form doesnt also maximise?

If you want to ensure that a secondary form opening off a first form is viewed as below,
then you need to amend one of the form property settings:

Change the Pop Up Property to YES

The second
form opens
and is
viewed
without
covering
the
information
in the first
form!

Happy Computers 020 7375 7300

Page 77

Microsoft Access 2007 - Useful controls on forms

Stopping a secondary form from maximising


1. Open the second form in Design view
2. (Select the Form by Clicking in the top-left corner, as shown below)
You should have
a black square in
this box, if the
form is selected

3. Click on the Property Sheet button

4. Scroll down until you see the Pop Up property

5. Change this to YES


6. Close the Properties window and Ctrl + S to save
7. Close the Form

Open the first form and try it out!

Page 78

Happy Computers 020 7375 7300

Microsoft Access 2007 - Useful controls on forms

Editing a form for data entry only


Editing a form so that it can only be used to add new records
Usually a form will open at the first record. However, most of us use some forms mainly
to insert new records. Wouldnt it be useful to edit a form so that it always opened at a
brand new record and didnt allow any of the existing data to be changed?
1. Open the form you wish to change in Design view

2. (Select the form by clicking in the top-left corner as shown below)


You should have a
black square in
this box

3. Double-click on the black box

Happy Computers 020 7375 7300

(The Properties box should appear)

Page 79

Microsoft Access 2007 - Useful controls on forms

4. On the Data Tab Change Data Entry to Yes


Click here
to change it
to Yes

5. Ctrl + S to save
Go to Form view and try it out!

Page 80

Happy Computers 020 7375 7300

Microsoft Access 2007 - Tab Controls

Tab Controls
Tab controls
What is a tab control?
If you are working with a long form, it is easier for the person viewing or typing
information in, if you break the form down into smaller pages:

Click on one
of these to
view, amend
or add more
information
about this
employee!

What benefits do I gain by creating tab controls?


Tab Controls provide an easy way to view several pages of information as a single set
within one form:

You can separate information into different categories and place it on different
pages
You can view lots of information in one form by moving between the pages
You can add and amend information in any of the pages

How many ways are there to add information into tab controls?
There are two main ways to add fields (your information) into tab controls:

Create a blank form and add the fields individually (see next page)
Create a long form with all your fields in it and then cut and paste them in groups
(see page Error! Bookmark not defined.)

Happy Computers 020 7375 7300

Page 81

Microsoft Access 2007 - Tab Controls

Creating Tab Controls from a blank form


Summary of the 2 steps
Creating Tab Controls form a blank form has two main steps:

Create a new form in Design view


Insert a Tab Control and then add the fields you want

Step 1 - Creating a new form in Design view


1. Click on Create tab on ribbon

2. Click on
3. Choose Design view

4. The field list pane should open on the right hand side (if it doesnt

click

on the Tools group

5. Drag the fields you require from the Field List pane (on the right) onto the
Form

Page 82

Happy Computers 020 7375 7300

Microsoft Access 2007 - Tab Controls

Drop your fields on to the middle of your form!


When you drop them in the middle Access automatically spaces the
Labels and Controls out properly. You can move them later if you need
to.

Happy Computers 020 7375 7300

Page 83

Microsoft Access 2007 - Tab Controls

Step 2 - Insert a Tab Control then add the fields you want
1. Drag onto the Form all the fields you need on the form itself (ie not on Tabs)

2. Drag down the edge of your form to make room for the Tab Control if
necessary

When you
get this
shape, drag
down

3. Click on the Tab Control button (in the Controls group)

4. Click on your form where you would like your Tab Control to go

Page 84

Happy Computers 020 7375 7300

Microsoft Access 2007 - Tab Controls

5. Click and drag fields onto the Tab control (you can select several at once
from the Field List pane by holding the Control key down as you click)

Happy Computers 020 7375 7300

Page 85

Microsoft Access 2007 - Tab Controls


6. Click on to the second page of your Tab Control to select it

7. Select the fields that you want to go on the second page of your Tab Control
and click and drag them.
8. Close the Field List Pane
9. Ctrl + S to Save

What if I need more pages?


It is really easy to create them, see the next section for details

Adding new pages


Adding new pages to your tab control
You may want more than two pages, which is the number added by default. It is really
easy to add more

1. Go to Design view of the form


2. Right-click on the last Page tab

Page 86

Happy Computers 020 7375 7300

Microsoft Access 2007 - Tab Controls

3. Click on Insert Page


A new page will be created for you:

Now you can drag on to it more fields and add new pages, as necessary!
4. Ctrl + S to Save

What if I want to rename my pages to something more appropriate?


It is really easy to rename them, see the next section for details

Changing page names


Changing the page names of your tab control
You may want to rename your pages to something more appropriate than the name
given by default. It is really easy to rename pages

1. Go to Design view of the form


2. Double-click on the page name

Happy Computers 020 7375 7300

Page 87

Microsoft Access 2007 - Tab Controls

Doubleclick here!

The Page Properties panel will open up:

3. Type an appropriate name in the Caption area of the page property(format


tab)

Repeat steps 2 and 3 until all your pages have been renamed:

4. Close the Page Properties pane


5. Ctrl + S to Save

Page 88

Happy Computers 020 7375 7300

Microsoft Access 2007 - Tab Controls

Moving pages
Moving pages around in your tab control
Now you have created all the pages in your tab control, you may want to move them
into a more appropriate order. It is really easy to move pages

1. Go to Design view of the form


2. Right Click on one of the Page tabs
Right Click here!

3. Click on Page Order

4. Click on the Page you want to move

(to Select it)

5. Click on these buttons as appropriate


Or
When you have finished:

6. Click on
7. Ctrl + S to Save

Happy Computers 020 7375 7300

Page 89

Microsoft Access 2007 - Tab Controls

Moving & resizing tab controls


Now that you have some space to work in on your form, you will probably want to move
your tab control into a more appropriate position near the top of the form, as well as
resize it so that you can view all the tabs without scrolling.

Moving tab controls


1. Go to Design view of the form
2. Click on an edge of your tab control to Select it ( ensure you have selected
the tab control not just one page)

3. Then Click and Drag on the border area of the selection to Move your tab
control an appropriate position on your form
What should my mouse look like?
Your mouse will look like a four headed arrow when you are moving the
selection correctly!

Resizing tab controls


1. In Design view of the form
2. Click on an edge of your tab control

Page 90

(to Select it)

Happy Computers 020 7375 7300

Microsoft Access 2007 - Tab Controls

3. Click and Drag


on a Size handle
where you want to
change the size

What should my mouse look like?


Your mouse will look like a double-headed arrow
when you resize a tab control!

4. Ctrl + S to Save

Changing the style


You can easily change the style of your tab controls, for example:

Make the tab controls transparent, so that you can see the format of the form,
rather than a grey box
Turn the tabs at the top of the control into buttons
Change the font name and size etc of the tabs
Allow more than one row of tabs (this is particularly useful if you have created
lots of pages!)

Can I make each page look different?


No, you cannot specify a different style for each of your pages!

Happy Computers 020 7375 7300

Page 91

Microsoft Access 2007 - Tab Controls

Changing the style


1. Go to Design view of the form
2. Click on an edge of your tab control

(to Select it)

3. If the Property Sheet pane is not visible click


You are now ready to change the Properties that you want to.
For example:

Preventing the tab control from being transparent


If you have chosen a colourful format (eg from Autoformat) for your form then by default your tab
control will be transparent to allow the format of the form to show through. To make it opaque:

Change the Back Style property to normal

Turn the tabs at the top of the control into buttons


Change the Style property to Buttons

Change the font name and size etc of the tabs


Change the Font properties, as appropriate:

Page 92

Happy Computers 020 7375 7300

Microsoft Access 2007 - Tab Controls

Allow more than one row of tabs


Change the Multi Row property to Yes

When you have finished:


1. Close the Property Sheet pane
2. Ctrl + S to Save
You are now ready to switch to Form view

Happy Computers 020 7375 7300

Page 93

Microsoft Access 2007 - Macros

Macros
Creating macros
What is a macro?
A macro is a set of one or more actions that each perform a particular task.
For example:
Automatically maximising a form when you open it
Automatically opening a form used for data entry, at a new record
Printing a report at the click of a button
Finding and filtering records to speed up your work
Exiting your database and Access at the click of a button

What benefits do I gain by creating macros?


Macros provide an easy way to automate a repetitive or routine task that you find
yourself doing regularly.
Automating regular tasks builds efficiency and accuracy into your database

How many ways are there to create macros?


There are two main ways to create macros:

Creating a macro in the Macros window and then attaching it to a command


button or form (this is the way we will show you)
Creating a macro through the Properties of a command button or form that
already exists
Macros and Command buttons

What benefit do I gain by attaching a Macro to create a command


button, rather than using the Command Button Wizard to create
them?
Generally speaking, if you are creating lots of forms with the same
command buttons, it is quicker and easier to create the first set and then
copy and paste them elsewhere.
If you have used the Command Button Wizard to create your buttons
you cannot do this they wont work when they have been pasted!

What is a macro group?


You may sometimes find it convenient to group a number of related macros together.

Page 94

A macro group is a series of macros that appears together in the same Macro
window

Happy Computers 020 7375 7300

Microsoft Access 2007 - Macros

What does a macro window look like?


What does a macro look like when youve created it?
A Macro might look something like these examples:
A macro with two actions
When the macro is run, this sequence
of Actions will happen one after the

Action Arguments provide Access


with additional information on how
to carry out the action!

Comments are just optional


descriptive text that you can
add!

A group macro containing seven macros, each with only one action

A group macro displays the individual


Macro Name of each one!

Happy Computers 020 7375 7300

Page 95

Microsoft Access 2007 - Macros

Planning which macros you need


When should I start creating my macros?
You are ready to start creating macros in your database, when you have already built:

Your tables (and their relationships)


Your most important queries (to test the structure of your database actually
works)
Your forms and the reports that you need

What sort of things do I need to consider when I am deciding which


macros I need?
These are some of the things you will need to consider:

What sorts of actions do you want your macros to perform?


Will the macros run when you press a button?
Will the macros run when you open a form?
Which macros can you group together (rather than creating lots of individual
ones)?

Plan this on paper first!

Creating macros
Once you have planned which macros you need, you are ready to create them!

Creating macros directly through the macro window


These are the general steps to follow when creating a macro:

1. From the Create tab of the ribbon click on

Page 96

Happy Computers 020 7375 7300

Microsoft Access 2007 - Macros


2. Choose an Action from the list

3. (Type a Comment to describe your action, if you want to)


4. Change the Action Arguments
(if required)
Repeat Steps 2 to 4 until you have added all the macro Actions you need
5. Ctrl + S to save
6. Type a name that clearly describes the Macro

7. Click on OK
What should I call my macro?
When saving a macro it is good practice to identify it as a macro in the
name.
For example:

It is also good practice not to leave spaces and to capitalise the first
letter of each word.

You can now attach your Macro to a command button or form!

Happy Computers 020 7375 7300

Page 97

Microsoft Access 2007 - Macros

Creating macro groups


Once you have planned which macro groups you will need, you are ready to create
them!

Creating macro groups directly through the macro window


These are the general steps to follow when creating a macro group:

1. From the Create tab of the ribbon click on

2. Click on the Macro Names button


added to your window

An extra Macro Name column is

3. Type a name for your first macro dont leave spaces and capitalise the first
letter of each word
4. Choose an Action from the list

5. (Type a Comment to describe your action, if you want to)

Page 98

Happy Computers 020 7375 7300

Microsoft Access 2007 - Macros


6. Change the Action Arguments

(if required)

Repeat Steps 4 to 6 until you have added all the macro Actions you need for this macro.
Repeat Steps 4 to 7 until you have added each individual Macro with the Actions that
you need
7. Ctrl + S to save
8. Type a name that clearly describes the Macro

9. Click on OK
What should I call my macro?
When saving a macro group it is good practice to identify it as a macro
group in the name.
For example:

It is also good practice not to leave spaces and to capitalise the first
letter of each word.
You can now attach your Macro to a command button or form!

Happy Computers 020 7375 7300

Page 99

Microsoft Access 2007 - Macros

Macros and command buttons


Once you have created your macros or macro groups, you will need to decide which
ones will be attached to command buttons. These are the steps you follow to do this.

Attaching macros to command buttons


1. In Design view of the form

(the form you want to add the button to)

2. Click the use Control Wizards button OFF


group)

(in the Controls

Turn this
OFF!

3. Click on the Button button


4. Click on your form
to appear)

(in the controls group)


(where do you want the Command Button

5. Click on the Property Sheet button

(if it is not selected already)

6. Find the On Click property (under the event tab)

7. Click on the downward arrow to select the Macro you want

(you might need to resize the Property Sheet pane to display the Macro
names in full)

Page 100

Happy Computers 020 7375 7300

Microsoft Access 2007 - Macros

8. Choose the Macro you want to attach to your button from the list

9. Find the Caption property under the Format tab and type an appropriate
caption:

10. Close the Property Sheet pane


11. You might need to resize your button

(so the whole caption is displayed)

Double-click on one of the


Size handles

12. Ctrl + S to Save


13. Click on the View button and click on your button to try it out!

Happy Computers 020 7375 7300

Page 101

Microsoft Access 2007 - Macros

Macros and forms


Once you have created your macros or macro groups, you will need to decide which
ones will be attached to forms. These are the steps you follow to do this!

Attaching macros to forms


1. In Design view of the form

(the form you want to attach the macro to)

2. (Select the Form, by Clicking here)


You should have a black
square in this box, if the
form is selected

3. Click on the Property Sheet button


4. Find the On Open property on the Event tab of the Property Sheet

5. Click on the downward arrow to select the Macro you want

(you might need to resize the Properties window to display the Macro names
in full)
6. Choose the Macro you want to attach to your form from the list

7. Close the Properties window


8. Ctrl + S to Save
9. Close your form
10. Open your form and see if your Macro has run!)

Page 102

Happy Computers 020 7375 7300

Microsoft Access 2007 - Macros

Some useful macros


When you are ready to start creating macros, you might not know where to begin, so
here are some useful macros to help you get started!

Creating a macro to close a form at the click of a button

1. From the Create tab of the ribbon click on


2. Choose the Close Action from the list

3. (Type a Comment to describe your action, if you want to)

Do I need to change the Action Arguments?

No. If you want to be able to use this macro to Close many forms, then
you dont need to change the Action Argument to close something
specific!

4. Ctrl + S to Save
5. Type a name that clearly describes the Macro
What should I call my macro?
When saving a macro it is good practice to identify it as a macro in the
name.
It is also good practice not to leave spaces and to capitalise the first
letter of each word.

Happy Computers 020 7375 7300

Page 103

Microsoft Access 2007 - Macros

6. Click on OK
7. Close your macro
You can now attach your Macro to a command button!
1. In Design view of the form

(the form you want to add the button to)

2. Click the Use Control Wizards button in the Controls group to OFF
Turn this
OFF!

3. Click on the Button button


4. Click on your form
appear)

(in the Controls group)


(where you want the Command Button to

5. Click on the Property Sheet button


still selected)

(make sure your button is

6. Find the On Click property (on the event tab)

7. Click on the downward arrow to select the Macro you want

Page 104

Happy Computers 020 7375 7300

Microsoft Access 2007 - Macros


8. Choose the Close Macro from the list

9. On the format tab of the Property Sheet pane, find the Caption property.
Type an appropriate caption for your button
(this is the text that will be displayed on your button

10. Close the Property Sheet pane


11. Ctrl + S to save
12. Go to Form View and click on your button to try it out!

Copy this button into all of your forms!


Dont forget because we have attached a Macro to our Command
Button we can copy and paste this button as many times as we want!

Copying a command button with a macro attached


1. Go to Design view of the form with the command button you want to copy

2. Select the button you want to copy


3. Press CTRL C

(to copy the button)

4. Close your form


5. Open the form that you want to copy the button into, in Design view
6. Press CTRL V

(to paste the button)

7. (You will probably need to move the button to an appropriate position on the
form)
8. Ctrl + S to Save
9. Go to Form View and click on your button to try it out!

Happy Computers 020 7375 7300

Page 105

Microsoft Access 2007 - Macros

Creating a macro group to filter records in a form at the click of a button


For example, we would like to be able to choose to sometimes see the following
selections when we are working in the Employees Information form:

Just current employees


All the employees
Just those working in the admin department
Just those working in the finance department
Just those working in the management team department
Just those working in the trainer department

1. From the Create tab of the ribbon click on

2. Click on the Macro Names button


3. Type an appropriate Name for your first macro
(dont leave spaces, capitalise the first letter of each word)

4. Choose the ApplyFilter Action from the list

5. (Type a Comment to describe your action, if you want to)

6. Change the Action Arguments


For example:

How will I know what to type?


There are some general rules to follow which should help you work out
what to do in your own examples
Enclose field names in square brackets

Page 106

Happy Computers 020 7375 7300

Microsoft Access 2007 - Macros

If you are searching for text, enclose it in quotes


If you are searching for dates, enclose them in hashes
If you are searching for numbers, type the number with no
commas or signs
If you are searching on a Yes/No field, do not enclose yes or no in
quotes
7. Type an appropriate Name for your second macro

8. Choose the ShowAllRecords Action from the list

(there are no Action Arguments for this Action)


9. (Type a Comment to describe your action, if you want to)
10. Type an appropriate Name for your third macro

11. Choose the ApplyFilter Action from the list

12. (Type a Comment to describe your action, if you want to)


13. Change the Action Arguments
For example:

Repeat Steps 11 to 14 for each department


14. Ctrl + S to Save

Happy Computers 020 7375 7300

Page 107

Microsoft Access 2007 - Macros


15. Type a name that clearly describes the Macro Group
What should I call my macro group?
When saving a macro group it is good practice to identify it as a macro
group in the name.
It is also good practice not to leave spaces and to capitalise the first
letter of each word.

16. Click on OK
17. Close your macro
You can now attach your Macros to command buttons!
1. In Design view of the form

(the form you want to add the button to)

2. Click the Use Control Wizards button in the Controls group to OFF
Turn this
OFF!

3. Click on the Button button


4. Click on your form
appear)

(in the Controls group)


(where you want the Command Button to

Repeat steps 3 and 4 until you have all the Buttons that you need:

Page 108

Happy Computers 020 7375 7300

Microsoft Access 2007 - Macros

5. Click on the Property Sheet button


still selected)

(make sure your button is

6. Find the On Click property (on the event tab)

7. Click on the downward arrow to select the Macro you want

8. (you may need to resize the Property Sheet Pane to display the Macro
names in full)

9. Choose the Close Macro from the list

10. On the format tab of the Property Sheet pane, find the Caption property.
Type an appropriate caption for your button
(this is the text that will be displayed on your button

Happy Computers 020 7375 7300

Page 109

Microsoft Access 2007 - Macros

11. Select your next button and repeat Steps 6 to 10 and so on for all your
buttons
12. Close the Property Sheet pane
13. Ctrl + S to save

Dont worry
about aligning
and resizing
them; we can
sort that out!

Go to Form View and click on your buttons to try them out!

Aligning and resizing your buttons


1. Click above the first button and drag over the rest to Select them all

Click here,
and drag
over the
rest of the
buttons

2. Click on
3. Click on

in the Control Alignment group to align left


in the position group to even out the spacing

4. (Keep you buttons selected)

Page 110

Happy Computers 020 7375 7300

Microsoft Access 2007 - Macros

Double Click
on a Size
handle to
resize all the
buttons in one
go!

5. Ctrl + S to Save
6. Click on the View button

When I Click on my Show Current


Records button, Access applies a filter to
the records and only selects those that
meet the criteria in our macro!

Creating a macro to maximize a form upon open, and start at a new record
Why not do this the easy way!
For an even easier way to make a form start at a new record see Page
79 on Changing the Data Entry options.
However, that method will not let you see any of your existing records in
the form. To see the existing records as well, follow the instructions
below.

Happy Computers 020 7375 7300

Page 111

Microsoft Access 2007 - Macros

1. From the Create tab of the ribbon click on


2. Choose the Maximize Action from the list

3. (Type a Comment to describe your action, if you want to)


4. Choose the GoToRecord Action from the list

5. (Type a Comment to describe your action, if you want to)


6. Change the Action Arguments to New

7. Ctrl + S to Save

8. Type a name that clearly describes the Macro

9. Click on OK
10. Close your macro

Page 112

Happy Computers 020 7375 7300

Microsoft Access 2007 - Macros


You can now attach your Macro to a form (or as many forms as you want)!
11. In Design view of the form

(the form you want to attach the macro to)

12. (Select the Form, by Clicking here)


You should have a black
square in this box, if the
form is selected

13. Click on the Property Sheet button


14. Find the On Open property on the Event tab of the Property Sheet

15. Click on the downward arrow to select the Macro you want

(you might need to resize the Properties window to display the Macro names
in full)
16. Choose the Macro you want to attach to your form from the list

17. Close the Properties window


18. Ctrl + S to Save
19. Close your form
20. Open your form and see if your Macro has run!)

Happy Computers 020 7375 7300

Page 113

Microsoft Access 2007 - Macros

Another useful macro


Creating a macro to automatically add text to a field
For example:
When I type Suzy in the FirstName
field, and then Cornwell in the
LastName field, it automatically
adds this text to a Salutation field
here!

What if this isnt the correct Salutation?


You can amend this text if you like, in our example it simply defaults to
what you key into the first two fields.

Summary of the 2 steps


Creating a macro to automatically add text to a field has two main steps:

Create a new field in the table (if necessary)


Add the new field to your form and create the macro

Step 1 Create a new field in the table (if necessary)


1. Open the Table in Design view
2. Select the row BELOW where you want to insert the new field
We want to
insert our
new field
between
LastName
and Gender

3. Click on the Insert Rows button

Page 114

Happy Computers 020 7375 7300

Microsoft Access 2007 - Macros


4. Type your new field name

Type your
new field
name here

5. Choose the correct Data Type


6. Ctrl + S to Save

Step 2 Add the new field to your form and create the macro
1. Open the Form in Design view

2. Click on

from the tools group

3. Click and Drag your new field to the form


Click and
Drag this
field to the
form

For example:

4. Close the Field list panel


5. Select the field you want to attach the Macro to
Which field do I want to attach the Macro to?
In our example, we want the salutation field to show the persons name
automatically, once we have typed in the Surname, so we select the
LastName field.

Happy Computers 020 7375 7300

Page 115

Microsoft Access 2007 - Macros

6. Click on the Property Sheet button


7. Find the On Exit property
8. Click on the Builder button

(to the right of the On Exit property)

9. Click on Macro Builder

10. Click on
11. Choose the GoToControl Action from the list

12. Change the Action Arguments


Type here the
name of the
field that you
want to add
text to
automatically

For example:

13. Click

if it is not already clicked

14. Choose the SetValue Action from the list

15. Change the Action Arguments, as follows

For example:

Page 116

Happy Computers 020 7375 7300

Microsoft Access 2007 - Macros

This is the name of the


form that holds the field
you want to add text to
automatically

This is the name of the


field you want to add
text to automatically

This expression tells Access the


name of the form that holds the
fields with the information you want
to copy

Or:

This expression would add just


the first letter of the FirstName
field and then the all of the
LastName field

Happy Computers 020 7375 7300

Page 117

Microsoft Access 2007 - Macros

16. Ctrl + S to Save with a suitable name.

17. Close the macro

You should now be back in your form

18. Click on the Save button

(to save the changes in your form)

Go to Form view and try it out!

The salutation I typed in has changed!


This macro is attached to the last name field, so every time you Click
into this field and then exit it, the macro will run again, therefore
changing the salutation back to the default.

Page 118

Happy Computers 020 7375 7300

Microsoft Access 2007 - Combining controls and objects

Combining controls and objects


Combining controls and objects
Wouldnt it be great if I could select my criteria from a drop down list and run a report
based on that criteria!
By combining
controls like
combo boxes
and command
buttons with
objects like
reports this is
possible!

Happy Computers 020 7375 7300

Page 119

Microsoft Access 2007 - Combining controls and objects

Wouldnt it be great if I could type my date criteria into a form, rather than into design
view of a query, and then run a report based on that criteria!
By combining
controls like text
boxes and
command buttons
with objects like
reports, this is
possible!

Page 120

Happy Computers 020 7375 7300

Microsoft Access 2007 - Combining controls and objects

A report that selects its criteria from a drop down


list!
In our example, we will assume you regularly want to run a report, which shows
employees and their training, grouped by department.
Rather than having to remember the departments, you want to be able to choose from a
drop down list and run a report based on that selection!

Summary of the 4 steps


Creating a report that selects its criteria from a drop down list has four main steps:

Create and save a blank form with a combo box


Create a query with criteria that refers to the form and combo box
Create a report based on the query
Bring it all together and add command buttons to your form

Step 1 - Create and save a blank form with a combo box


1. Click on the Create tab of the Ribbon and select
Forms group

from the

2. Click on Design View

Check the Control Wizard!

Make sure the Control


Wizards button is
selected

3. Click on the Combo Box button


4. Click on your Form
appear)

Happy Computers 020 7375 7300

(in the Controls group)


(where you want the Combo Box to

Page 121

Microsoft Access 2007 - Combining controls and objects


5. Make sure the first choice is selected:

6. Click on
7. Choose the Table to base your Combo Box on
Which table do I want?
If we assume that you have already created lookup tables for all the key
criteria you would want to select on in a query, then choose the
appropriate lookup table here!
In our example, the table we want is tblLookupDepartment because it
holds a list of all our Departments!

8. Click on
9. Double-click on the Available Field, to Select the field

10. Click on
11. Choose the sort order for the Combo Box

Page 122

Happy Computers 020 7375 7300

Microsoft Access 2007 - Combining controls and objects

12. Click
13. (To increase the column width of the Combo Box, place your mouse pointer
at the edge of the heading, and Double-click)

14. Click on
15. Type an appropriate Label for your Combo Box

16. Click on

A Combo Box will be created for you at this point you will see it in Design view: (you
may need to drag the control to the right of the label
It should have
Unbound in this
side of the Combo
box

(you may need to drag the control to the right of the label

17. Click on the Properties button

Happy Computers 020 7375 7300

Page 123

Microsoft Access 2007 - Combining controls and objects


18. Type a Name for your Combo box
(this is CRUCIAL, as you will need to refer to this name in the query)

19. Ctrl + S to save

20. Type a name that clearly describes the form


(this is CRUCIAL, as you will need to refer to this name in the query)

21. Minimise your form

Step 2 - Create a query with criteria that refers to the form and Combo Box

1. Click on the Queries Design button


Tab of the Ribbon)

(in the Other group of the Create

2. Double-click on the tables you want to use

Which tables do I want to use?


In our example, we regularly want to run a report, which shows
employees and their training, grouped by department. Therefore, we
need the tables that hold all of this information ie in this
exampletblEmployee and tblTrainingAttended and tblTraining
CourseDetails!

Page 124

Happy Computers 020 7375 7300

Microsoft Access 2007 - Combining controls and objects

3. Click
4. Double-click on the fields to include in the query
(make sure you include the field you want to add criteria to)

In our example, we need


the Department field

5. Click into the criteria row of the field you want to select on (e.g. Department)
6. Click on the Build button in the Query Setup group
Expression Builder will open)

Happy Computers 020 7375 7300

(The

Page 125

Microsoft Access 2007 - Combining controls and objects

7. Double-click on Forms

8. Double-click on the Loaded Forms


(Note: if your form is not still open you should chose All Forms here)
9. Click on the form you just created

10. Double-click on the name of your Combo Box (e.g.ComboDepartment)

11. Click OK
(your field should now look like this- you may need to
widen the column:)

Page 126

Happy Computers 020 7375 7300

Microsoft Access 2007 - Combining controls and objects

12. Ctrl + S to save


13. Type a name that clearly describes the query

14. Click on

15. Close the query window

Step 3 - Create a report based on the query


from the

1. Click on the Create tab on the ribbon and select


Reports Group
2. Choose the Query to base your report on
step 2)

(you created it in

This is our
query

3. Double-click on the Available Fields, to Select the fields you want

Happy Computers 020 7375 7300

Page 127

Microsoft Access 2007 - Combining controls and objects

4. Click on
5. (Choose how you want to view the information, if you have selected more
than one table in your query)

6. Click
7. Choose the grouping in this case we want to group by department

Select Department
and click the arrow
button

8. Click on

9. Choose a field to Sort by

Page 128

Happy Computers 020 7375 7300

Microsoft Access 2007 - Combining controls and objects

10. Click on
11. Choose a Layout for your Report

12. Click on
13. Choose a Style for your Report

14. Click on

Now you will be prompted to Save the report by giving it a Title:

15. Type in a name that clearly describes the report


(bear in mind it will appear as an actual Title on the report but it can be
changed easily enough later!)

Happy Computers 020 7375 7300

Page 129

Microsoft Access 2007 - Combining controls and objects

16. Click on

When is my report saved?


Your report is saved as soon as you give it a Title and Click on Finish in
the Report Wizard!
A blank report will open up in Print Preview
17. Close the report

Step 4 - Bring it all together and add command buttons to your form
1. Maximise your Form frmSelectDepartmentRunReport
(you created it in step 1 and should be in Design view when you maximise it)

Check the Control Wizards button first!

Make sure the Control


Wizards button is
selected

2. Click on the Command Button button

3. Click on your form


appear)

(in the Controls group)

(where you want the Command Button to

4. Select the Category and Action you want

Page 130

Happy Computers 020 7375 7300

Microsoft Access 2007 - Combining controls and objects

We have
selected
the Report
Operations
category

and the
Preview
Report
action

5. Click on
6. Select the Report you want to Preview

7. Click on

8. Click on the Text choice, and amend the text

(if you want to)

9. Click on
10. Type an appropriate name for your button

(this will not be displayed)

11. Click on

A Command Button will be created for you at this point you will see it in Design
View

Happy Computers 020 7375 7300

Page 131

Microsoft Access 2007 - Combining controls and objects


Before you start tidying your form up, it is worth checking that everything actually
works
Checking everything works
1. Click on the View button
2. Click on the downward arrow of your combo box

Click here to
view the
Departments
to choose
from

3. Choose the Department you want to see in your report

4. Click on your button

Your report should open

5. Close the report

Page 132

Happy Computers 020 7375 7300

Microsoft Access 2007 - Combining controls and objects


6. Ctrl + S to Save

Dont forget to tidy your form up


In Design view, for example you could:
Change the font name and size of your label, make the font bold
Move this label above your combo box
Add a Close button

Happy Computers 020 7375 7300

Page 133

Microsoft Access 2007 - Combining controls and objects

A report that selects its criteria from two text


boxes!
In our example, we will assume you regularly want to run a report that allows us to
select training courses between two dates, grouped by employees.
Rather than having to keep changing the criteria in a query, you would like to be able to
type the training dates into a form and then run a report based on that selection!

Summary of the 4 steps


Creating a report that selects its criteria from two text boxes has four main steps:

Create and save a blank form with two text boxes


Create a query with criteria that refers to the form and the two text boxes
Create a report based on the query
Bring it all together and add command buttons to your form

Step 1 - Create and save a blank form with two text boxes
1. Click on the Create tab on the ribbon and select
Forms group)

(from the

2. Close the Field List Pane which has just opened


3. Click on Design view

4. Click on the Text Box button


5. Click on your Form
appear)

6. Click on the Text Box button


7. Click on your Form
appear)

(in the Controls group)


(where you want the first Text Box to

(in the Controls group)


(where you want the second Text Box to

You should now have two text boxes on your form at this point you will see them in
Design view

Page 134

Happy Computers 020 7375 7300

Microsoft Access 2007 - Combining controls and objects

It should have
Unbound in this
side of the Text
boxes

8. Select the first Text box, Click on the Property Sheet button

9. Type a Name for your first Text box


(this is CRUCIAL, as you will need to refer to this name in the query)

10. Select the second Text box


11. Type a Name for your second Text box
(this is CRUCIAL, as you will need to refer to this name in the query)

12. Ctrl + S to Save

13. Type a name that clearly describes the form


(this is CRUCIAL you will need to refer to this name in the query)

Happy Computers 020 7375 7300

Page 135

Microsoft Access 2007 - Combining controls and objects

14. Minimise your form

Click here
to Minimise

Step 2 - Create a query with criteria that refers to the form and the two Text
Boxes

1. Click on the Query Design button on the Create tab of the ribbon
the Other group)

(in

2. Double-click on the tables you want to use (or Ctrl + click each one and then
click Add)
Which tables do I want to use?
In our example, we regularly want to run a report, which allows
us to select training courses between two dates, grouped by
employees. Therefore we need the tables that hold all of this
information!

3. Click
4. Double-click on the fields to include in the query
(make sure you include the field you want to add criteria to)

Page 136

Happy Computers 020 7375 7300

Microsoft Access 2007 - Combining controls and objects

5. Click into the criteria row of the field you want to select on (e.g. CourseDate)
6. Click on the Builder button in the Query Setup group
(The Expression Builder will open)

7. Type Between in the white box

8. Double-click on Forms

9. Double-click on the Loaded Forms


(Note: if your form is not still open you should chose All Forms here)

Happy Computers 020 7375 7300

Page 137

Microsoft Access 2007 - Combining controls and objects


10. Click on the form you just created

11. Double-click on First Date in the second column

12. Type And at the end of the expression

13. Double-click on the Text Box for the Last Date

14. Click OK
15. Ctrl + S to Save
16. Type a name that clearly describes the query

Page 138

Happy Computers 020 7375 7300

Microsoft Access 2007 - Combining controls and objects

17. Click on
18. Click the Close button on the query window (and close the Property Sheet
pane)

Step 3 - Create a report based on the query


(in the

1. Click on the Create tab on the ribbon and click on


Reports group)
2. Choose the Query to base your report on
step 2)

(you created it in

This is our
query

3. Double-click on the Available Fields, to Select the fields you want

4. Click on
5. (Choose how you want to view the information, if you have selected more
than one table in your query)

6. Click on

dont add any further grouping and click

7. Choose a field to Sort by

Happy Computers 020 7375 7300

Page 139

Microsoft Access 2007 - Combining controls and objects

8. Click on
9. Choose a Layout for your Report

10. Click on
11. Choose a Style for your Report

12. Click on
Now you will be prompted to Save the report by giving it a Title:
13. Type in a name that clearly describes the report
(bear in mind it will appear as an actual Title on the report but it can be
changed easily enough later!)

Page 140

Happy Computers 020 7375 7300

Microsoft Access 2007 - Combining controls and objects

14. Click on

When is my report saved?


Your report is saved as soon as you give it a Title and Click on Finish in
the Report Wizard!
A blank report will open up in Print Preview
15. Close the report

Step 4 - Bring it all together, add command buttons to your form


1. Maximise your Form
(you created it in step 1 and it should be in Design view when you maximise
it)

Check the Controls Wizard first (Design tab of Ribbon in Controls


group!

Make sure the use


Control Wizards button is
selected

2. Click on the Button button

(in Controls Group)

3. Click on your form


appear)

(where you want the Command Button to

4. Select the Category and Action you want

Happy Computers 020 7375 7300

Page 141

Microsoft Access 2007 - Combining controls and objects

We have
selected
the Report
Operations
category

and, the
Preview
Report
action

5. Click on
6. Select the Report you want to Preview

7. Click on
8. Click on the Text choice, and amend the text

(if you want to)

9. Click on
10. Type an appropriate name for your button

(this will not be displayed)

11. Click on
A Command Button will be created for you at this point you will see it in Design
View

Before you start tidying your form up, it is worth checking that everything actually
works

Page 142

Happy Computers 020 7375 7300

Microsoft Access 2007 - Combining controls and objects


Checking everything works
1. Click on the View button
2. Click into your first text box and type the first date
Click into your second text box and type the second date

Type the training


dates here that
you want to see
between

3. Click on your button

Your report should open

4. Close the report


5. Ctrl + S to save

Happy Computers 020 7375 7300

Page 143

Microsoft Access 2007 - Combining controls and objects

Dont forget to tidy your form up


In Design view, for example you could:
Change the actual text in the labels
Change the font name and size, make the font bold
Add a Close button

Adding some more functionality


To make it easier for users to enter dates into text boxes use the Date/time
picker:
1. In the Design View of the Form select the TextBox and Open the

Property Sheet pane

(if it is not already open)

2. Change the Format property to a Date Format

3. Ensure the Date/Time picker property is set for Dates

4. Go to Form View you can now select dates from the picker if you wish:

Page 144

Happy Computers 020 7375 7300

Microsoft Access 2007 - Combining controls and objects

Improving the look of forms


You can use Form properties to improve the look of forms that you dont intend to use
for adding and viewing records.

For example, in the forms we have just been creating

We dont
need the
record
selector bar

We dont need
record
navigation
buttons

We dont
need scroll
bars

You can also use AutoFormat to change the background of your form!

Changing the form properties and using autoformat


1. In Design view of the form
2. Select the Form, by Clicking in the top-left corner, as shown below

Happy Computers 020 7375 7300

Page 145

Microsoft Access 2007 - Combining controls and objects

You should have a black


square in this box, if the
form is selected

3. Click on the Properties button

4. Click on the AutoFormat button

and Change these properties, as below

on the Arrange tab of the Ribbon

5. Choose a format

6. Click on

7. Click on the View button

Page 146

(to view your changes)

Happy Computers 020 7375 7300

Microsoft Access 2007 - Combining controls and objects

8. Click on the Save button

9. Close the form

Happy Computers 020 7375 7300

Page 147

Microsoft Access 2007 - Creating a user interface

Creating a user interface


Creating a user interface
What is a user interface?
Instead of your database opening at the database window, you can create an opening
screen and hide the database window.
For example:
This screen opens
up, when I open
the database!

When I Click
here the
Reports
menu opens!
When I
Click here
the Forms
menu
opens!

When should I start creating my user interface?


You are ready to start creating the user interface in your database when you have
already built:

Your tables (and their relationships)


Your most important queries (to test the structure of your database actually
works)
Your forms and the reports that you need

Page 148

Happy Computers 020 7375 7300

Microsoft Access 2007 - Creating a user interface

What sort of things do I need to consider when I am planning my user


interface?
These are some of the things you will need to consider:

What do you want to appear on your opening screen?


Will other forms need to open from there?
What buttons will appear on your forms and what macros will you need to run
when you press the buttons?
Which macros can you group together (rather than creating lots of individual
ones)?

Plan all of this on paper first!

Planning on paper first!


Consider some of the points above when you are planning your user interface on
paper

Once you have planned everything, you can get started!

Summary of the 4 steps


Creating a user interface has four main steps:

Create a form for your opening screen


Create the forms that will open from your first screen
Create the macros that will open everything
Add the command buttons that will make your macros work

Happy Computers 020 7375 7300

Page 149

Microsoft Access 2007 - Creating a user interface

Step 1 - Create a form for your opening screen


1. Click on the Create tab on the ribbon and select
Forms group)

(from the

2. Close the Field List Pane which has just opened

3. Maximise your form

Now we are going to change some of the Form Properties:


4. Select the Form, by Clicking in the top-left corner, as shown below
You should have a black
square in this box, if the
form is selected

5. Click on the Property Sheet button


below (on format tab)

and Change these properties, as

Now we are going to create a macro so that this form is always maximised upon
opening:
6. Scroll down until you find the On Open property (under the Event tab)

7. Click on the Expression builder button


8. Click on the Macro Builder

Page 150

Happy Computers 020 7375 7300

Microsoft Access 2007 - Creating a user interface

9. Click on
10. Choose the Maximize Action

11. Close the Macro window


The On Open property now shows an Embedded Macro

Now we are going to change the format of the form:

12. Click on the AutoFormat button


Ribbon

on the Arrange tab on the

13. Choose a format


(perhaps choose a format that is different from your other forms, so that it is
obvious which ones are a part of your user interface)
14. Click on

Now we are going to add some descriptive text at the top of the form:

15. Click on the Label button


tab )
16. Click on your Form

Happy Computers 020 7375 7300

(in the Controls group of the Design

(where do you want the Label to appear)

Page 151

Microsoft Access 2007 - Creating a user interface


17. Type some appropriate text

18. Change the font name and size, make it bold, change the font colour etc
using these buttons on the Home tab of the Ribbon:

19. Resize the label


Doubleclick on a
Size handle

It should now look something like this:

20. Ctrl + S to Save


21. Type an appropriate name for your form

22. Click on

Dont Close your form at this point!

Step 2 - Create the forms that will open from your first screen

Page 152

Happy Computers 020 7375 7300

Microsoft Access 2007 - Creating a user interface

Do I have to repeat everything in step 1?


No, rather than repeat all of the points in step 1 to create the forms that
will open from your first screen, we will use Save As to copy the first
form and then change the bits that need it!

1. With your form open

(you just created it in step 1)

2. Click on the Office Button


3. Click on Save As
4. Type an appropriate name for your next form

5. Click on
6. Select the Label in this form

7. Change the text to something appropriate and resize the box

8. Ctrl + S

(to save this change in your new form)

We are now going to repeat steps 2 to 8


9. Click on the File menu
10. Click on Save As
11. Type an appropriate name for your next form

Happy Computers 020 7375 7300

Page 153

Microsoft Access 2007 - Creating a user interface

12. Click on
13. Select the Label in this form

14. Change the text to something appropriate

15. Ctrl + S

(to save this change in your new form)

Keep repeating steps 2 to 8 as necessary

16. Close the last form

Step 3 - Create the macros that will open everything


Think about which buttons are on each of your forms each button will need a macro
attached to it!
Start by creating the macros that you will need on your opening screen, and then work
through the other forms.

1. Click on the Macro button

Page 154

Happy Computers 020 7375 7300

Microsoft Access 2007 - Creating a user interface

2. Click on the Macro Names button


3. Create your first macro, for example:
Choose the
OpenForm action

Type an
appropriate
Macro
name

Change the Action Arguments,


by selecting the form you want
to open

4. Create your next macro, for example

Choose the OpenForm


action again

Type an
appropriate
Macro
name

Change the Action Arguments,


by selecting the next form you
want to open

5. Create your next macro as above, for example

Happy Computers 020 7375 7300

Page 155

Microsoft Access 2007 - Creating a user interface


Create all of the macros you will need to open all of the forms on your menus, for
example:

Create a macro to exit the database

Type an
appropriate
Macro
name

Choose the
Quit Action

6. Ctrl + S to Save
7. Type a name that clearly describes the Macro Group

8. Click on

Page 156

Happy Computers 020 7375 7300

Microsoft Access 2007 - Creating a user interface


9. Close the Macro window

Step 4 - Add the command buttons that will make your macros work
1. Open your opening screen form

in Design view

2. Click the Control Wizards button OFF

(in the Controls group)

Create your first command button:

3. Click on the Button button


4. Click on your form
appear)

(in the Controls group)


(where you want the Command Button to

5. Click on the Property Sheet pane button


already)

(if it is not open

6. Find the Caption property and Type an appropriate Caption for the button

7. Find the On Click property (event tab) and Choose the Macro you want

Create your next button:

8. Click on your form

(where you want the next Button to appear)

9. Find the Caption property and Type an appropriate Caption for the button

Happy Computers 020 7375 7300

Page 157

Microsoft Access 2007 - Creating a user interface

10. Find the On Click property and Choose the Macro you want

Create any more command buttons you need, change the Caption and On Click
properties for each one!
Create the exit command button:
11. Click on your form
appear)

(where you want the Exit Command Button to

12. Find the Caption property and type Exit

13. Find the On Click property and Choose the Exit macro

14. Resize and align your buttons, if necessary


15. Ctrl + S to Save
16. Click on the View button
Your opening screen should look something like this:

Page 158

Happy Computers 020 7375 7300

Microsoft Access 2007 - Creating a user interface

Repeat these steps until you have created command


buttons on all your menu forms:
For example:

Instead of adding a button with the text


menus

on your secondary

You could add this type of text

You need to decide on the text that is most informative in your own
examples!

Happy Computers 020 7375 7300

Page 159

Microsoft Access 2007 - Creating a user interface

Page 160

Happy Computers 020 7375 7300

Microsoft Access 2007 - Creating a user interface

Opening your database at the opening screen


Once you have created the forms for your user interface, you are ready to set up the
last step which makes everything work automatically!
When you open the database in future, you would like to see your opening screen (not
the database window!).

Opening your database at the opening screen


1. Click on the Office button and select Access Options

2. Click on Current Database button

Happy Computers 020 7375 7300

Page 161

Microsoft Access 2007 - Creating a user interface


3. Choose your Opening form from the drop down list
Click here

4. Choose the options that you want to be available in your database

5. Click on
Close your database down, open it up again and check everything works!
How can I get back into the Database with all the options available?
Hold down Shift when you open your Database to open it with all the
standard functionality

Page 162

Happy Computers 020 7375 7300

Microsoft Access 2007 - Making things tidy

Making things tidy


Compact & Repair
Why should I Compact and Repair my Database?
For your Database to work at optimal performance, you should regularly compact your
database. This automatic feature deletes blank spaces that are currently taking up disk
space and making your Database file larger that necessary.

Using the wizard to Compact and Repair your Database


1. Click on the Office button
2. Click on Manage
3. Under Manage this Database
4. Click on Compact and Repair Database
Honey, I shrunk the Database!
This action will reduce your file size by about a third making it far easier
to work with.

Data separation
Avoiding problems and enhancing performance
Your tables should always be kept in a different database from the queries, forms,
reports and macros.
There are several reasons for this:

Multiple Users can access the database at once

You can give access to the database with all the queries, forms, reports and
macros, but keep the database with the tables in it stored somewhere else on
the network

You avoid the problem of someone accidentally deleting a table (with its data
and structure) if you keep the tables stored somewhere else on the network
(its really easy to just re-link a deleted table)

Happy Computers 020 7375 7300

Page 163

Microsoft Access 2007 - Making things tidy

Other users can customise their own forms, reports and other objects while
maintaining a single source of data on the network

You can backup the database with the tables in it on a daily basis

You can backup the database with the queries, forms etc in it as necessary
(when a change is actually made to the queries, forms etc)

If my tables are stored in a different database, am I only working on


a copy of the tables?
You ARE working on a copy, but because there is a live link between the
two databases, information is automatically updated in the usual way!
When do I need to separate my tables from everything else?
While you are creating your database and working on it, it can be
frustrating and time consuming to work on two copies. It is much easier
if you separate everything at the end!
Important Information!
Dont forget to make a backup of your database before you begin!

Using the wizard to separate your database


Important Information!
Dont forget to make a backup of your database before you begin!

In Access, open the database that you want to split.


1. Click on Access Database from the Move Data group of the Database Tools
tab on the Ribbon.
2. Click on database Utilities
3. Click on Database Splitter

Page 164

Happy Computers 020 7375 7300

Microsoft Access 2007 - Making things tidy

4. Click on

5. Choose where you would like to save the back-end of your database
Click here
to choose

What is the Back-end of your database?


The back-end will contain just your tables and their relationship(s). This
copy should be stored somewhere safe with limited access and usually
on a shared network drive.

6. By default Access will cal the Backend the same name with _be on the end.
If you wish you might change the name of your back-end database to
something appropriate

Happy Computers 020 7375 7300

Page 165

Microsoft Access 2007 - Making things tidy

7. Click on

8. Click on

Icons show
links ie we are
viewing the
Back End
database from
the Front end
database

9. Copy the Front end file onto every users C: drive

Which database do I give my users access to?


You give your users access to the front-end of your database with the
linked tables in it, and store the back-end database somewhere safe with
limited access normally on a shared network drive.Each user will have a
copy of the Front end on their C: drive

Updating Existing Links


You may wish to update links for example if you have added a field to a table
1. Open the front-end database
2. Click on linked table manager from Database Tools button on Ribbon

3. Click on the tickbox next to the table (or tables) you want to update the links
to:

Page 166

Happy Computers 020 7375 7300

Microsoft Access 2007 - Making things tidy

4. Click OK

Linking a new or missing table from your back-end database to your frontend
Important Information!
When working on linked databases it is crucial that they are both in the
locations where they will be stored. If you move the databases
afterwards the links may not work!
1. Open the front-end database

2. Click on the Access button


Ribbon

Happy Computers 020 7375 7300

from the External Data button on the

Page 167

Microsoft Access 2007 - Making things tidy


3. Browse for the Back End file and select option to Link

4. Click
5. Highlight all the new or missing tables you want to link to

6. Click on

Merging your Database back into One File


1. Open the front-end database
2. Delete the Linked tables

3. Click on the Access button


Ribbon

Page 168

(Select them, Press Delete)

from the External Data button on the

Happy Computers 020 7375 7300

Microsoft Access 2007 - Making things tidy


4. Browse for the Back End file and select option to Import

5. Click
6. Click on Select All to highlight all tables you want to import.

7. Click on

Setting a password for your database


You can limit who has access to your database by setting a password. This will ensure
that only those who know the password can use the database!

Setting a password
Close the database first!
Make sure that the database you want to set a password for is closed. If
the database is shared on a network, make sure all other users have
closed the database too! (You may wish to make a back up copy of the
database)

Happy Computers 020 7375 7300

Page 169

Microsoft Access 2007 - Making things tidy

1. Click on the Open from the Office button


2. Click on your database to Select it
3. Click on the arrow to the right of the Open button
Click here

4. Choose Open Exclusive

Your database should now open up!

from the Database tools group of the


5. Click on the
Database Tools tab on the Ribbon
6. Type in a password and then again. Make a note of it if you lose it, it will be
impossible to enter the database again

7. Click

Your password will be case-sensitive!


When you type your password and verify it, the case you use (whether
its lower case or upper case) is as much a part of the password as the
letters you type!

Page 170

Happy Computers 020 7375 7300

Microsoft Access 2007 - Making things tidy


Your database is now password protected the next time this database is opened the
user will be asked to type in the password before they can use it!

What if I forget my password?


If you lose or forget your password it cant be recovered and you wont
be able to open your database again!

Removing a password
If you want to remove a password from a database, you need to know what the current
password is before you can proceed.
1. Click on the Open from the Office button
2. Click on your database to Select it
3. Click on the arrow to the right of the Open button
Click here

4. Choose Open Exclusive

Your database should now open up!

from the Database tools group of the


5. Click on the
Database Tools tab on the Ribbon
6. Type in a password

Happy Computers 020 7375 7300

Page 171

Microsoft Access 2007 - Making things tidy

7. Click
Your database is no longer password protected the next time this database is opened
the user will be able to just open it in the usual way!

Creating a back-up of your database


When I use Save As Access only saves this table!
If you use the save as feature in access it will only be resaving the
individual table, query, form or report that you have selected.

Creating a copy of your Database from within Database


1. Open your Database
2. Click Start Button
3. Click on Manage
4. Click on Back up Database:
Access suggests the same location you may wish to choose eg a memory
stick. It suggests a filename consisting of the existing filename plus todays date
on the end

Creating a copy of your Database from outside Database


1. Close down your Database
2. Open Windows Explorer
Explore)

(Right-click on the Start button, Click

3. Navigate to the Folder where you database is stored

Page 172

Happy Computers 020 7375 7300

Microsoft Access 2007 - Making things tidy

4. Select the name of your Database


5. Right-click on the name

6. Choose Copy
7. Navigate to where you want to place your back-up copy

8. Right-click on the Folder name


9. Choose Paste
If you regularly back-up your database, include the date in the
name of the file so that you will easily be able to find the latest
version
Right-click on the file name
Choose Rename
Type the name of your choice

Happy Computers 020 7375 7300

Page 173

Microsoft Access 2007 - Index

Index
Backing-up your Database ............... 172
Cascade Delete ................................. 13
Cascade Update ................................ 13
Closing
Relationship Window ...................... 13
Combo Box
Based on a table ............................. 47
Find Records .................................. 60
Find Records - show full name ....... 64
Find Records - update .................... 66
Limit choices ................................... 52
Lookup comparison ........................ 45
More than one field ......................... 53
Trouble-shooting ............................. 59
Using............................................... 50
What is it ......................................... 45
Command Buttons
Format choices ............................... 69
View record on form........................ 73
Why create...................................... 68
Wizard............................................. 70
Compact & Repair............................ 163
Controls
On Forms ........................................ 44
What are they ................................. 44
Controls and objects ........................ 119
Creating a Password........................ 169
Database
Heirarchy ........................................ 24
Startup .......................................... 161
Deleting
Relationships .................................. 17
Repeated field in sub form .............. 37
Find records
Combo box ..................................... 60
Foreign Key .......................................... 8
Form
Data Entry ....................................... 79
Main and Sub Form Using .............. 40
Sub Forms ...................................... 25
Forms
Formatting..................................... 145
Properties ..................................... 145
Limit choices in Combo box ............... 52
Macro Group
Creating .......................................... 98
Window ........................................... 95
Macro Groups
What are they ................................. 94
Macros

Page 174

Command buttons ........................ 100


Creating .......................................... 96
Examples ...................................... 103
Forms............................................ 102
Planning .......................................... 96
What are they ................................. 94
Window ........................................... 95
Main and Sub form
Many to Many relationship .............. 26
Using it ............................................ 40
Using Queries ................................. 25
Main and Sub forms
What are they ................................. 25
Many to Many relationship ................... 6
Objects and controls ........................ 119
Password ......................................... 169
Primary Key ......................................... 8
Printing
Relationships .................................. 21
Problems
Relationships .................................. 14
Properties
Forms............................................ 145
Queries
Main and sub forms ........................ 25
Relational Tables ............................ 22
Two Tables ..................................... 22
Referential Integrity ............................ 12
Relationships
Creating .......................................... 11
Deleting........................................... 17
Design............................................... 5
Editing ............................................. 17
Examples .......................................... 9
Many to Many ................................... 6
Printing............................................ 21
Relational Queries .......................... 22
Trouble-shooting ............................. 14
What you Need ................................. 8
Window Display .............................. 19
Report and combo box ..................... 121
Report and text boxes ...................... 134
Setting a Password .......................... 169
Starting up Database ....................... 161
Sub
Forms.............................................. 25
Forms Changing Title ..................... 39
Sub form
Adding a Total................................. 41
Default view .................................... 36

Happy Computers 020 7375 7300

Microsoft Access 2007 - Index


Deleting repeated field ................... 37
Label .............................................. 39
Tab Controls
Add Pages ...................................... 86
Moving ............................................ 90
Moving pages ................................. 89
Page names ................................... 87
Resizing.......................................... 90
Style ............................................... 91
What are they ................................. 81
Table

Happy Computers 020 7375 7300

Linking .............................................. 8
Relationships .................................... 8
Trouble-shooting
Combo box ..................................... 59
Relationships .................................. 14
User interface
Creating ........................................ 150
Planning ....................................... 149
What is it....................................... 148
What's Wrong
Relationships .................................. 14

Page 175

Anda mungkin juga menyukai