Access 2007 Query
Access 2007 Query
FirstName
Surname
Age
John
Jones
35
Tracey
Smith
25
Anne
McNeil
30
Joe
Brown
39
Sue
Moore
33
The next stage is to select which table you are going to use in this
query. When the query design grid opened, the SHOW TABLE pop up
window should also have opened. If necessary you can open this
window manually by clicking the SHOW TABLE icon in the QUERY
SET UP group on the Access Ribbon.
So far there is only one table in your database - TABLE1. This should
be highlighted when the window opens, but if not, just click on it
once. Next click ADD. When you close the pop-up window by clicking
x,you should see a box labelled TABLE1 above the query design grid.
Select fields from Table
In the table1 box, you will see a list of its field names. We are going
to use all the fields in this query, so select each one individually by
double clicking on their names. You will now see the field names at
the top of each column in the Query Design Grid.
Click the save icon above the Access Ribbon. When prompted for the
query name, just use the default QUERY1. To run your query, click
the RUN icon in the RESULTS GROUP of the Access Ribbon. You
should now be presented with a datasheet displaying your query
results - JOHN JONES 35 and JOE BROWN 39.
Begin by selecting the CREATE TAB on the Access Ribbon. Then click
REPORT WIZARD from the REPORTS group to open the pop up
window.
The first page of the Report Wizard is almost identical to that of the
Form Wizard. On this page we will select QUERY1 as the DATA
SOURCE for the Report. This is done by selecting the query from the
list in the TABLES/QUERIES combo box. Then select all fields from
QUERY1 by clicking the double arrow to the right of the text box
labelled AVAILABLE FIELDS. The field names will now appear in the
SELECTED FIELDS text box on the right. Click next to go to the
second page of the wizard.
Page two of the wizard is where you can add grouping levels if
required. So we could, for example, group each person in our report
with others of the same age. We dont need to do this for this
particular example, but it is certainly a useful feature that we might
want to learn more about later. But for now, just click next.
4. Record Sort Order
Page three of the wizard is where you determine what order the
records are displayed in your report. So for example you might want
to display records in ascending order of age. For this example,
however, we are going to put your records into alphabetical order
for SURNAME and FIRSTNAME. Begin by clicking the top drop down
box and selecting SURNAME, and in the box 2 below select
FIRSTNAME. This means that records are sorted alphabetically by
surname, and if two surnames are the same, the FIRSTNAME is used
to determine which record comes first etc.
Click Next
This page of the Wizard is where you set the lay out for your report.
There are various lay out options, but in our case we shall keep to
the default setting of TABULAR.
Click next.
6. Style
For style, select Access 2007 from the list and click next.
7. Name of Report
Open your database if it is not already open. Click the CREATE tab
on the ACCESS RIBBON and then select MORE FORMS from the
forms group.
A drop down list of form types appears. You need to select FORM
WIZARD from this list.
2. Select table and fields
On the first page of the form wizard we select which table we are
going to use as the DATA SOURCE. Since there is only one table in
this database so far, it should already be selected for us in the
TABLES/QUERIES combo box.
Underneath there is a list of the four fields in your table. You could
select each field individually by highlighting the field name and
clicking the single arrow >. We can, however, select all four just by
clicking the double arrow >>. Once they have been transfered into
the right hand box they are selected. We can now click NEXT to go
to page 2 of the form wizard.
3. Form Layout
Here we select a style that from the list box. Preview a style by
clicking on its name. This step just determines how the form looks
aesthetically. Once you have selected a style to your taste, click
NEXT again.
5. Form Title
This is the last stage of the wizard. Here we are going to choose the
name for our form - lets say FORM1. We are going to leave the radio
button selected for OPEN THE FORM TO ENTER OR VIEW
INFORMATION
All we need to do now is click FINISH and our form should like
something like this:
As you can see, the form opens with the first record in your original
table displayed. You can navigate through each record using the
NAVIGATION BUTTON at the bottom left of the form window.
To move to the next record click the right arrow button on the
navigation control. To move to the last record click the >| button on
the navigation control. To move backwards through the recordset
use the left arrow buttons. You could edit any record from the form,
which will update the data in your table. For now, though, just try
navigating through the three records without changing any data.
7. Create New Record via Access Form
Now that you know how to move through the recordset, lets finish
off by adding two more records. To do this click the star button on
the right of the navigation control. This should bring up a blank
record. Add JOE for firstname, BROWN for surname, and 39 for age.
Click the star again to bring up a new blank record, and enter SUE
MOORE 33. When you have finished click x on the form window to
close.
This tutorial lesson has shown you how to create an Access Form
using the form wizard, and how to navigate and add records using
Access Forms. There are also other ways to Create an Access
Form from Scratch orCustomize an Access Form, but this is as
far as we are going to go in this particular lesson.
Like all other databases, Access 2007 stores data in tables. They
look a lot like the cells of a spreadsheet with columns and rows.
Each horizontal column represents a table record, and each vertical
column represents a table field. See Table example below:
A simple Table
ID Number
FirstName
Surname
Age
John
Jones
35
Tracey
Smith
25
Anne
McNeil
30
Select the CREATE tab on the Access ribbon. Next select the TABLE
DESIGN icon from the TABLES group. This creates a new table.
This brings up the TABLE DESIGN GRID where you enter each field
name and its data type. The first field we are going to create is the
ID field which is going to contain a unique reference number for
each record. Enter the name "ID" into the first column of the first
row in the grid. Because we want Access to automatically generate a
unique reference number, select AUTONUMBER from the drop down
list in the data type column. You can also enter a description for
each field, but this is not essential.
On the next row the field is going to be called FIRSTNAME and the
data type is going to be TEXT. On the third row the field name is
SURNAME with the data type again being TEXT. And finally, the last
field name is AGE and the data type here is going to be NUMBER.
Before you save the table you will need to choose the Primary Key,
which in this case is ID. To do this, select the ID row by clicking on it,
and then simply click the primary key symbol on the Ribbon.
You can now save the table by clicking the save icon on the top left
of the screen above the Access Ribbon. To view your table select
DATASHEET VIEW from the VIEWS group under the DESIGN TAB. This
brings up the datasheet view of the table that you have just created.
You should see your field headings running across the top of the
table.
Although entering data onto the datasheet table is not a part of the
design process, the table now exists as a database object, and you
can test it by entering some information into the cells.
Select the first cell in the FIRSTNAME column and enter the name
JOHN. For SURNAME enter JONES, and for AGE enter 35.
NB just ignore the column underneath the heading ADD NEW FIELD.
We created all the fields we needed in design view.
You have now entered the first record in the table - record 1 for John
Jones aged 35. You can now press the return key and the record will
save automatically. You are now ready to enter the second record on
the next row - TRACEY SMITH 25. Press return and then fill in the
data for the last record we are going to do for now - ANNE McNEIL 30
Your datasheet table should now look like this: