0% found this document useful (0 votes)
15 views8 pages

revieweerrr

Uploaded by

Cristine Versoza
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views8 pages

revieweerrr

Uploaded by

Cristine Versoza
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Modifying Queries Hiding fields within queries

To modify your query, you must enter Design view, the view you used when creating Sometimes you might have fields that contain important criteria, but you
it. There are two ways to switch to Design view: might not need to actually see the information from that field in the final results.
For example, take one of the queries we built in our last lesson: a query to find the
On the Home tab of the Ribbon, click the View command. Select Design View from
names and contact information of customers who had placed orders. We included
the drop-down menu that appears.
Order ID numbers in our query because we wanted to make sure we only pulled
In the bottom-right corner of your Access window, locate the small view icons. Click customers who had placed orders.
the Design View icon, which is the icon farthest to the right. However, we really didn't need to see this information in our final query
results. In fact, if we were just looking for customer names and addresses, seeing
Once in Design view, make the desired changes, then select the Run command to view the order number mixed in there might have been distracting. Fortunately, Access
your updated results. makes it easy to hide fields while still including any criteria they contain.
To hide a field within a query:
Sorting queries
1. Open the query and switch to Design view.
Access allows you to apply multiple sorts at once while you're designing your query. 2. Locate the field you want to hide.
This allows you to view your data exactly the way you want. 3. Click the checkbox in the Show: row to uncheck it.
A sort that includes more than one sorted field is called a multilevel sort. A multilevel
More types of queries
sort allows you to apply an initial sort, then further organize data with additional sorts. For
instance, if you had a table full of customers and their addresses, you might choose to first sort By this point, you should understand how to create a simple one-table or
the records by city, then alphabetically by last name. multi-table query using multiple criteria. Additional queries offer you the ability
to perform even more complex actions with your database. One of these is the
When more than one sort is included in a query, Access reads the sorts from left to
totals query, which lets you perform calculations with your data.
right. This means the leftmost sort will be applied first.

To apply a multilevel sort: Totals queries


Sometimes setting simple criteria won't give you the results you need,
Open the query and switch to Design view. Locate the field you want to sort first. In
especially when you're working with numerical values. You may want to see your
the Sort: row, click the drop-down arrow to select either an Ascending or Descending sort.
query results grouped or counted in some way. For example, let's say we want to
Repeat the process in the other fields to add additional sorts. Remember, the sorts are find out how many of each menu item at our bakery has been ordered—how
applied from left to right, so any additional sorts must be applied to fields located to the right many Almond Croissants, Apple Pies, and so on. To do this, we could create a
of your primary sort. If necessary, you can rearrange the fields by clicking the top of a field totals query to find the sum of the quantities for each item.
and dragging it to a new location.
First, the totals query will group all similar menu items from separate
orders (for example, Almond Croissants). Then, the Sum function will add the
values in the Quantity field to calculate the total number sold for that item.
The Sum function helped us find the desired information in this example, but in other
situations you may need to use a different function to find the answer you need. There are
several functions you can choose from:
 Count: Counts the total number of each item
 Sum: Adds the values together
 Average: Finds the average of the values
 Maximum: Returns the highest value
 Minimum: Returns the lowest value 5. When you are satisfied with your query design, select the Run command on
 First: Returns the first—or earliest—value the Query Tools Design tab to run the query.
 Last: Returns the last—or most recent—value

To create a totals query:


For our example, we want to find the total number we've sold of each of our menu
items, so we'll use a query showing us all of the menu items we've sold. If you want to follow 6. The query results will be displayed in the query's Datasheet view, which
along in our database, open the Menu Items Ordered query. looks like a table. If you want, save your query by clicking the Save
command on the Quick Access toolbar.
1. Create or open a query you want to use as a totals query.
2. From the Design tab, locate the Show/Hide group, then select the Totals command. Parameter Query
A parameter query is one of the simplest and most useful queries you
can create. Because parameter queries are so simple, they can be easily
updated to reflect a new search term. When you open a parameter query,
Access will prompt you for a search term and show you query results that
3. A row will be added to the table in the design grid, with all values in that row set to Group reflect your search.
By. Select the cell in the Total: row of the field you want to perform a calculation on, then
When you’re running parameter queries, search terms act as variable
click the drop-down arrow that appears.
criteria, which are query criteria that change each time you run the query. For
instance, let's say we own a bakery and want to create a query that will quickly
look up orders that were placed on a certain date. We could create a parameter
query with variable criteria in the Date field. This way, each time we run the query
a dialog box will appear to prompt us to enter the date we’d like our query to
search for.
4. Select the calculation you want to be performed in that field. In our example, we want to
add the quantities of products we've sold, so we'll select the Sum option.
We’ll enter the date we want, then Access will run the query using the date we entered 2. The New Query dialog box will appear. Select Find Duplicates Query Wizard from
as a search term. the list of queries, then click OK.
To create and run a parameter query:
1. Create a query as you normally would, modifying the table joins if necessary, selecting
the fields to include in your query, and adding any non-variable criteria to the
appropriate fields in the Criteria: row.
2. Locate the field or fields where you want the variable criteria to appear, then select the
Criteria: row.
3. Type the phrase you want to appear in the prompt that will pop up each time you run
your query. Make sure to enclose the phrase in brackets [ ]. For example, in our
parameter query that searches for orders placed on a certain date, we might type our
criteria like this: [What Date?].
4. On the Design tab, click the Run command to run your query. A dialog box will appear 3. Select the table you want to search for duplicate records, then click Next. We're
with the specified prompt. Enter your search term and click OK to view your query searching for duplicate customer records, so we'll select the Customers table.
results.

You can simply open an existing parameter query to run it. 4. Choose the fields you want to search for duplicate information by selecting them
and then clicking the right arrow button. Only select fields that should not be
To create a find duplicates query: identical in nonduplicate records. For instance, because we're searching for
1. Select the Create tab on the Ribbon, locate the Queries group, and click the Query duplicate customers we'll only select the First Name and Last Name fields because
Wizard command. it's unlikely that multiple people with the exact same first and last names would
place orders at our bakery.
5. When you've added the desired fields, click Next.
6. Select additional fields to view in the query results. Choose fields that will help you 8. If Access found any duplicate records in your query, they will be displayed in the
distinguish between the duplicate records, and choose which one you want to keep. query results. Review the records and delete any outdated or incorrect records as
In our example, we'll add all of the fields relating to customer addresses, plus the needed.
Phone Number field because records with identical customer names might contain
nonidentical information in this field. When you're satisfied, click Next.

Tips for resolving duplicate records


 Save your duplicate records queries, and run them often.
 Investigate potential duplicate records by looking at linked data in other tables. You
can do this by searching for these records' record ID numbers in related tables. Is one
record linked to mostly old orders while another contains recent ones? The latter is
likely to be the current one.
 Once you decide which record to delete, make sure you won't be losing any
information you might need. In our example, before we deleted our duplicate record we
7. Access will suggest a name for your query, but you can type a different name if you found all of the orders linked to that record's ID number and replaced them with the ID
want. When you're satisfied with the query name, click Finish to run your query. number of the record we decided to keep.

Query criteria quick reference guide


Below, you'll find a guide containing 20 of the most common criteria used in Access
queries. While these criteria are all fairly simple, each one can help you carry out meaningful
searches of your data.
When entering the criteria, write them exactly as they are written in the second column,
replacing x with your search term—or in the case of dates, replacing mm/dd/yyyy with the
desired date.

Simple criteria for all data types:

Simple criteria for dates:

Simple criteria for text:

Forms in Access are like display cases in stores that make it easier to view or get the
items that you want. Since forms are objects through which you or other users can add, edit, or
display the data stored in your Access desktop database, the design of your form is an
important aspect. There's a lot you can do design-wise with forms in Microsoft Access. You
can create two basic types of forms −
 Bound forms
 Unbound forms

Simple criteria for numbers: Bound Forms


 Bound forms are connected to some underlying data source such as a table, query, or SQL From the menu, you can create a Multiple Items form, a Datasheet form, a Split form, or
statement. even a Modal Dialog form. These are typically bound forms;
 Bound forms are what people typically think of when they think of the purpose of a form.
-select the object in
 Forms are to be filled out or used to enter or edit data in a database.
 Examples of bound forms will typically be what users use to enter, view or edit data in a navigation pane first
database.
- More Forms and
Unbound Forms
Multiple Items
 These forms are not connected to an underlying record or data source.
 Unbound forms could be dialog boxes, switch boards, or navigation forms.
 In other words, unbound forms are typically used to navigate or interact with the database
at large, as opposed to the data itself.
Types of Bound Forms
1. Single Item Form - This is the most popular one and this is where the records are
displayed — one record at a time.
Split Form
2. Multiple Item Form - This displays multiple records at a time from that bound data This type of form is divided in equal halves, either vertically or horizontally. One half
source. displays a single item or record, and the other half displays a list or a datasheet view of
3. Split Form - The form is divided into halves, either vertically or horizontally. One half multiple records from the underlying data source.
displays a single item or record, and the other half displays a list or provides a datasheet
view of multiple records from the underlying data source
There are a few methods you can use to create forms in Access. For this, open your Database
and go to the Create tab.
In the Forms group, in the upper right-hand corner you will see the Form Wizard button.
Form Wizard will ask for the layout that we would like for our form. We have columnar,
tabular, datasheet and justified layouts.
arrow with a line after it, that's the last record button-If you want to jump to the very last
record in that form or that table

Multiple Item Form


About subforms
If you created a form from a table whose records are linked to another table, your form In either Layout or Design view, select the Design tab, then locate the Tools group.
probably includes a subform. A subform is a datasheet form that displays linked records in a Click the Property Sheet command.
table-like format. Fthe subform contains the name, quantity, and price of each item contained
In the Property Sheet, click the All tab, then locate the Visible option on the fifth row.
in the order, which is all useful information.
Click the drop-down arrow in the column to the right, then select No.
Adding design controls
To set a field to autofill with the current date:
Design controls set restrictions on the fields
I The Property Sheet will appear in a pane on the right. On the form, select the field you want
in your forms. This helps you better control to automatically fill in the current date. This must be a field with the date data type.
how the data is entered into your forms,
which in turn helps keep the database consistent. Command buttons
If you want to create a way for users of your form to quickly perform specific actions
A combo box is a drop-down list you and tasks, consider adding command buttons. When you create a command button, you specify
can use in your form in place of a field. an action for it to carry out when clicked. By including commands for common tasks right in
Combo boxes limit the information users your form, you're making the form easier to use.
can enter by forcing them to select only the
 Record Navigation command buttons, which allow users to move among the records in
options you have specified.
your database
To create a combo box:  Record Operation command buttons, which let users do things like save and print a
record
In Form Layout view, select the Design tab, then locate the Controls group. Select the
 Form Operation command buttons, which allow users to quickly open or close a form,
Combo Box command, which looks like a drop-down list.
print the current form, and perform other actions
 Report Operation command buttons, which offer users a quick way to do things like
preview or mail a report from the current record
To resize form components:
Switch to Layout view.

Select the field or button


you want to resize, then hover
your mouse over the edge. Your
cursor will become a double-
sided arrow.

To hide a field:
If you want to make a field take up more or less space than one column, you can use the Merge Saving reports
and Split commands. The Merge command combines two or more cells, while the Split
You can save reports in other formats so they'll be viewable outside of Access. This is
command divides a cell.
called exporting a file, and it allows you to view and even modify reports in other formats and
programs.

Access offers options to save your report as an Excel file, text file, PDF, HTML
document, and more. Experiment with the different export options to find the one that best
suits your needs.
To export a report:
From the Home tab, click the View command, then select Print Preview from the drop-
down list. Locate the Data group on the Ribbon. Select one of the file type options, or click
More to see options to save your report as a Word or HTML file.

You can make these changes using formatting techniques and tools similar to the ones
you would use to modify shapes in Word and other Office programs. Simply select the object A dialog box will appear. Select the location where you want to save the report. Enter a
you want to modify while in Layout or Design view and use the formatting options on the file name for the report, then click Publish.
Format tab to customize its appearance.
Reports allow you to organize and present your data in a reader-friendly, visually
appealing format. Access makes it easy to create and customize a report using data from any
query or table in your database.
To print a report:
From the Home tab, click the View command, then select Print Preview from the drop-down
list. Your report will be shown as it will appear on the printed page
Print Preview shows you how your report will appear on the printed page. It also
allows you to modify the way your report is displayed, print it, and even save it as a different
file type.

You might also like