0% found this document useful (0 votes)
17 views

Query

The document discusses different types of queries in Microsoft Access including append, update, parameter, crosstab, and delete queries. It provides steps for creating each type of query and examples of how each can be used.

Uploaded by

biruk molla
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Query

The document discusses different types of queries in Microsoft Access including append, update, parameter, crosstab, and delete queries. It provides steps for creating each type of query and examples of how each can be used.

Uploaded by

biruk molla
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Query

Creating Append Queries

What are Append queries?

An append query adds a set of records (rows) from one or more source tables (or queries) to one
or more destination tables. Typically, the source and destination tables reside in the same
database, but they don't have to. For example, suppose that you acquire some new customers and
a database that contains a table of information about those customers. To avoid entering that new
data manually, you can append it to the appropriate table in your database. You can also use
append queries to:
1. Append fields that are based on criteria. For example, you might want to append only the
names and addresses of customers who have outstanding orders.

2. Append records when some of the fields in one table don't exist in the other table. For
example, suppose that your Customers table has 11 fields, and the fields in the Clients
table in another database match 9 of your 11 fields. You can use an append query to add
only the data in the matching fields and ignore the others.

Note. You cannot use append queries to change the data in individual fields in existing records.
You can only use Append queries to add rows of data.

Begin How Append Tables using the following Steps


1. Open Your Database
2. Click Create Tab
3. Click Query Design

4. Add Tables to QRE to design

5. Save the query By the name Append Query


6. Click on Query Type Group Append. The Append dialog box appears.

Operate Database Page 1


Query

The Append Query with the Append dialog box

7. Adjust Fields name [Student ID] to Student ID and again change [EMP-ID] to EMP-ID

8. Testing the New Query


You should always test a new query by running it.
Step 1. On the Design tab, in the Results group, click Run to run the query.
Step 2. Click yes on the confirmation box to finish appending the record
Step 3. Double click Student Table

Operate Database Page 2


Query

Update Queries
Create a Select Query in Design View to determine the records that will be updated.
Modify the query by adding the appropriate data source(s) and criteria. In this example, a
company will be raising All Employee by Percent for example by 5%
1. Click Create Tab the click on Other Group
2. Click Query Design View

3. Add Employee Table Fields to the QBE

4. Click on Query Tools Click Update Query

5. Insert The value to change Salary of Employee


6. Write on Salary Filed on Update to =[Salary]*0.5+[Salary]

7. Click Run Command


8. Dialog box will be appear Click Yes

9. Save the Query by the Name Update Query and Close the Query
10. Finally Open The Employee Table

Operate Database Page 3


Query

Creating a Parameter Query


Parameter queries are interactive filters that allow you to specify a different filter criterion every
time you open up the query. You can design the query to prompt you for more than one piece of
information; for example, you can design the query to prompt you for two dates. Access will
then retrieve all records that fall between those two dates.
Open up an existing query in Design view.
Decide which field you wish to use in your filter.
In the design grid, click in the field’s Criteria cell.
 If your parameter query requires an operator, type that operator in the Criteria cell
E.g. [Enter EMP-D]
 Complete your filter expression by inserting a parameter label in square brackets.
Every time you run your query, you will be asked to provide this parameter

.
Continue to add criteria in the appropriate fields to complete your query.
Right-click on the query’s tab at the top and click Save.
From the Design ribbon, go to the Results area and click on the Run button to test your
query.

The Enter Parameter Value window will appear for each criterion that has to be
specified.

Enter the numeric value you wish to use in your filter.


Click on the button labeled OK.
Access will run the query and retrieve your data from the database.

Operate Database Page 4


Query

Tip: Parameter queries are helpful when used as the basis for forms, reports and data access pages.
For example, you can create a monthly earnings report based on a parameter query. When you
print out the report, Access displays a dialogue box asking for the month that you want the
report to cover. Once you enter the desired month, Access will print the appropriate report.

Creating a Crosstab Query


Open up an existing query in Design view.

From the Design ribbon, go to the Query Type area and click on the Crosstab button.

A Crosstab row will appear in the design grid.


For the field(s) whose values you want to appear as row headings:
Click on the down-facing arrow next to the box labeled Crosstab.
From the drop-down menu that appears, select Row Heading.

Repeat these steps for each field you desire to use as a row heading in the query.
You can also choose to make a field a Column Heading or a Value in the same manner

Operate Database Page 5


Query

Note: You MUST have at least one of each (Row Heading, Column Heading, and Value) to run a
Crosstab Query.
Tip: You can select Column Heading for one field only, and as with Row headings, you must leave

Delete Queries
Create a Select Query in Design View to determine the records what will be deleted.
Modify the query by adding the appropriate data source(s) and criteria. In this example, a
company wishes to cut costs at the lowest payroll levels and accordingly removes employees
making less than 1,000
Crete Query Using Design View
Add Employee Table
Insert All fields to QBE

Save Query
Click Query Tools(Design) under Query Type Delete Query

Write on Criteria Cell to Delete Less than 1000 Write <1000

Click on the Run button. A Microsoft Office Access window will appear, warning that fields
from the table will be deleted.

Click on the button labeled yes.

Operate Database Page 6


Query

The specified records will be deleted from your table. Open your table to verify that the
proper records were deleted.
Click on the Save button if you are satisfied with the action query results.

Tip: Note that delete queries always delete entire records, not just selected fields within records.

Operate Database Page 7

You might also like