Professional Documents
Culture Documents
Table Validation Queries and Data Retrieval Creating Forms Generating Reports
Table Validation Queries and Data Retrieval Creating Forms Generating Reports
Table Validation Queries and Data Retrieval Creating Forms Generating Reports
Table validation
Creating forms
Generating reports
Validating data in MS Access
• Validation is used to tests incoming data to make sure that it is what is expected
or required in the (field) table.
• Validation rule control property
• If the data is not in the right format, the validation displays an error message.
• There are three types of validation:
• Field validation rule
• Record validation rule and
• Validation on a form.
2
Steps in Validating a Field
• Open the table in which to validate records.
• Click on the Fields tab, navigate to Field Validation Rule under Validation,
type in the rule and then click OK.
• Use the Expression Builder to create the rule.
• Example: Add two new fields (Age and Sex), making sure the following
validation rules are enforces for each field.
• Age should be greater than 15 or between 15 and 26
• The entry for sex must be “M” or “F” 3
4
5
Creating Relationships in Tables
• A Relationship describes the type of link between two tables as supported by a
specific join property.
6
Creating Relationships in Tables
• Click on Database tools
• On the right pane, drag and drop each of the tables that is to be connect together into the
empty space
• Click and drag the studentID on the studentInfo table to meet with the ID on the grade
table
• On the Edit Relationship dialog box that appears, click on create then close. When prompt
to save changes, click on save changes. 7
Relationship Types in Tables
• One-to-many: Implies that a record in one table is related to many records
in a second table.
• One-to-one: Implies that a record in one table is related to just one record
in the second table. e.g. one man married to only one wife.
• Many-to-many: Implies that many records in one table are related to many
records in the second table.
8
Creating Queries
•A query is a question that is asked about the data stored in a database.
•The Simple Query Wizard allows a user to select records and fields quickly.
10
Creating Query using query wizard (Cont.)
• Select the table that contains the field.
• On the Available Fields window select the fields, click on greater than (>) sign
• The fields appears on the Selected Fields click Next.
11
Creating Query using query wizard (Cont.)
• Choose level of details by selecting
“Details” or “Summary”
• click next.
• Enter the query title and click
12
Creating Query using query wizard (Cont.)
13
Creating query using design
• Go to the Create tab and the click on the query design command
• On the dialog box, select the table to be queried, click “Add” and the “close”
• The selected table appears as a small window in the Object relationship pane,
having the list of all the field in the table.
• Double click on the fields to be queried.
15
Creating a Query (Example)
• On the StudentInfo table, do the following:
• List the names and matric numbers of the students
• List the students showing the name, dept. and sex fields
• Show all the details except that of students more than 20 years of age
• Display only the male students
• Display only the female students
• Display only the girls in accounting
16
Creating a Form in MS Access
• A form is an object used to enter, edit, and view records in a database
• Forms can be designed, using the following:
• forms, use
• Form Wizard or
• use the Form tool to create a simple form with one mouse click
17
Creating Forms (Cont.)
• There are several ways of creating a form in an MS Access, lets consider creating
a form from an existing table.
• In the Navigation Pane, click the table or query that contains the data.
• On the Create tab, click Form.
• MS Access creates a form and displays it in Layout view.
• Design changes like adjusting the size of the text boxes to fit the data, can be
made if necessary.
18
19
20
Generating Report
• A report is used to pull data from a table or a query.
• Reports are the printouts of data from table, query or form.
• Tables and queries can be printed out, but the printouts will include grids lines.
• Forms can be printed, but forms usually print extra boxes and colours.
• Reports are used to turn data to information. .
• Any error noticed on a report, can be corrected via the table, query or form.
• A report is a formatted printout (screen display) of the contents of one or more
tables in a database. 21
Generating Report (Cont.)
• The Report tool places all the fields from a selected table (query) on a report,
making it the quickest way to create a report
• Click the table or query on which you want to base your report.