Assignment - ACCESS
Assignment - ACCESS
QUESTIONS
You are requied to answer all question and answers and must be in accordance with
the step-by-pictorial.
7.
8. Open a table or query in Query Design view.
9. Click the down-arrow in the first field on the Field row and then select the
tablename.* option. The table name appears on the table line.
10. Click the Run button. Access retrieves all of the fields and records for the table and
displays them in Datasheet view.
11.
12. Clik ok.
13. Change from Datasheet View to Query Design View
14. After you run a query, you can easily change back to Query Design view and make
modifications to your query or create a new query.
15. To change to Query Design view:
16.
17. Activate the Home tab.
18. Click the down-arrow below View in the Views group. A menu appears.
19. Click Design View. Access changes to Query Design view. You can modify your query.
Save a Query
After you create a query, you can save it. You can rerun a saved query at any time. If
you change the data on which the saved query is based, you will see the changes
when you rerun the query.
1. Open the table or query on which you want to base your new table on in Query
Design view.
2. Enter the criteria on which you want to base your new table.
3. Click the Make Table button. The Make Table dialog box appears.
4. Type the name you want to give your new table.
5. Click OK.
6. Click Run. You see the following prompt.
7. Click Yes.
8. Close the query. (Right-click the querys tab and then click Close.)
9. Double-click the new tables name in the Navigation pane to view the new table.
but not both. (If you need this feature for pre-Access 2007 deployments, use this
feature in our Total Access Components).
by surname, and if two surnames are the same, the FIRSTNAME is used to determine which
record
comes
first
etc.
Click Next
7. Name of Report
Name your report REPORT1 and then click FINISH.
Your access report will now be displayed on the screen, and should look something like this:
1. he first step is to create a new Access Database. Lets call it Customer Orders.
2. Next create a new table called tblCustomers with the following fields - ID
(autonumber, primary field), FIRSTNAME (text), SURNAME (text), ADDRESS1
(text), CITY (text), and POSTCODE (text).
3. Create a new table called tblOrders with the following fields - ORDERID
(autonumber, primary field), ITEMORDERED (text), DATE (date), PRICE
(number, set the format property to currency), CUSTOMERID (number).
CustomerId is going to be the foreign field when we create the relationship.
4. To create the relationship, select the DATABASE TOOLS RIBON and click the
RELATIONSHIPS icon (from the SHOW/HIDE group).
5. This opens the RELATIONSHIPS window. You will also see the pop up SHOW
TABLE form the first time you open the window. We are now going to select
which tables are going to be used in the relationship.
6. There are just two tables in our example database. Click on tblCustomer to
highlight it in blue if it is not highlighted already. Then click add. Do the
same for tblOrder, then close the pop up SHOW TABLE form.You should now
see the two tables represented as separate box's in the RELATIONSHIPS
window. You will notice in the diagram below that each box has it's fields
7. We will now click the ID field in tblCustomer and drag it to the CUSTOMERID
field in tblOrder. Notice the mouse pointer image changes from a circle with
a line across to a plus sign as it hovers over the fields in tblOrder. When you
release the mouse button at the end of the click and drag operation, a new
EDIT RELATIONSHIPS pop up form opens.
8. Click the three tick boxes which say ENFORCE REFERENTIAL INTEGRITY,
CASCADE UPDATE RELATED FIELDS, and CASCADE DELETE RELATED
RECORDS. We won't be going into what these do in this blog post.
9. Click the CREATE BUTTON. Our table relationship is now in place. This is
what the database window looks like now. Note the line drawn by Access
between the ID field of tblCustomer and the CUSTOMERID field of tblOrder.
All we need to do now is enter some data and test out the relationship. Try entering
this data from the image below into tblCustomer:
Then enter this data from the image below into tblOrder:
Notice that each order in tblOrder has a CustomerId corresponding to one of the
customer ID's in tblCustomer. This is how we link each order to a particular
customer. To prove that this works, open up the tblCustomer table and click the +
sign's (left of table) on each customers row. This shows that Access has
automatically linked each order from tblOrder to it's corresponding customer in
tblCustomer.
All this gives us a basic idea of what table relationships are all about. There is,
however, much more to it than this. For example, once we have set up relationships
like this, we may create forms, queries and reports that reflect these relationships,
and exploit the advantages that this has over single table "flat file" database
applications. In the next blog post, I hope to write about creating a single Access
Form which allows us to enter data into both Customer and Orders tables together.