Ms Access Notes
Ms Access Notes
A new table appears in Datasheet View. You can start entering data right away, but you
should add some fields first.
A list of data types appears. See the table at the end of this lesson to learn more about your
options.
When selecting a field type, select the smallest or shortest field that is required for your data. For
example, don’t choose Large Number if you only need to store a 2-digit number.
5. Type a name for the field.
To change the name of a field header, double-click the field header and type the field name you
want to use.
3. Enter a field name in the Field Name column and press Enter.
4. Click the Data Type list arrow and select a data type for the field.
See the table at the end of this lesson for more information about data types.
5. Repeat steps 3-4 to add as many fields as you want.
6. When you’re finished, click the Close button. Save and name your table.
You can also create a table using an application part template. An Application Part is a predefined part of
a database, such as a table or form, that you can quickly insert and use in a database.
The application parts menu appears. The Quick Start section contains templates for creating
tables.
5. When you’re finished, click the Close button. Save and name your table
Access creates a new table from the application part template you selected.
SharePoint lists can be created within Access. To do this, you need to have an existing SharePoint site
that you can add the SharePoint list too.
Select Custom if you wish to specify your own fields or choose Existing SharePoint List if you
want to link to a list that has previously been created on the SharePoint site.
4. Enter the SharePoint URL address, a name for the new list, and any other information you’d like.
5. Click OK.
Task 29
An Access database is not a file in the same sense as a Microsoft Office Word document or a
Microsoft Office PowerPoint are.
Instead, an Access database is a collection of objects like tables, forms, reports, queries etc. that
must work together for a database to function properly.
We have now created two tables with all of the fields and field properties necessary in our
database.
To view, change, insert, or delete data in a table within Access, you can use the table’s Datasheet
View.
A datasheet is a simple way to look at your data in rows and columns without any special
formatting.
Whenever you create a new web table, Access automatically creates two views that you can start
using immediately for data entry.
A table open in Datasheet View resembles an Excel worksheet, and you can type or paste data
into one or more fields.
You do not need to explicitly save your data. Access commits your changes to the table when you
move the cursor to a new field in the same row, or when you move the cursor to another row.
By default, the fields in an Access database are set to accept a specific type of data, such as text
or numbers. You must enter the type of data that the field is set to accept. If you don't, Access
displays an error message −
Let us add some data into your tables by opening the Access database we have created.
Select the Views → Datasheet View option in the ribbon and add some data as shown in the following
screenshot.
Similarly, add some data in the second table as well as shown in the following screenshot.
You can now see that inserting a new data and updating the existing data is very simple in Datasheet
View as working in spreadsheet. But if you want to delete any data you need to select the entire row first
as shown in the following screenshot.
Now press the delete button. This will display the confirmation message.
Click Yes and you will see that the selected record is deleted now.
Task 30
Create a Query
You can also use the Query Wizard to create a query. Click the Create tab on the ribbon and
click the Query Wizard button in the Queries group.
3. Select the table(s) you want to add to the query and click Add.
4. Click Close.
You can also add tables to a query by dragging them from the Navigation Pane to the top half of
the Query window.
The Query window appears in Design View. Notice that the window is split. The top half
contains a box that displays all the fields in the table you added to the query. The bottom half of
the screen contains a design grid, which is where you will add the fields you want to appear in
your query.
You can also add fields by dragging the field from the field list onto the design grid.
Often you will have to use the field list's scroll bar to scroll up or down the list to find a field.
Now you need to specify any criteria for the query. Enter the criteria in the design grid's Criteria
row. For example, you could select to see only records whose City field contains "London", or
you could enter K* to return only results that begin with K.
6. Enter any search criteria for the field in the Criteria box.
Deselect the Show box for a field if you want to use a field in a query but you don't want it to be
displayed.
Save a Query
Once you have created a query, you'll want to save it to use later.
Run a Query
Your queries run when you open them through the Navigation Pane.
1. Open the query or click the Run button if you're in Design view.
You can create a select query by using the Query Wizard or by working in Design view. Some design
elements are not available when you use the wizard, but you can add these elements later by using Design
view. Although the two methods are somewhat different from each other, the basic steps are essentially
the same:
1. Choose the tables or queries that you want to use as sources of data.
2. Specify the fields that you want to include from the data sources.
3. Optionally, specify criteria to limit the records that the query returns.
After you have created a select query, you run it to see the results. To run a select query, you open it in
Datasheet view. If you save the query, you can reuse it whenever you need, for example, as a data source
for a form, report, or another query.
You can use the Query Wizard to automatically create a select query. When you use the wizard, you have
less control over the details of the query design, but the query is usually created faster than if you did not
use the wizard. Moreover, the wizard can catch some simple design mistakes and prompt you to perform
a different action.
2. In the New Query dialog box, click Simple Query Wizard, and then click OK.
3. Next, you add fields. You can add up to 255 fields from as many as 32 tables or queries.
a. Under Tables/Queries, click the table or query that contains the field.
b. Under Available Fields, double-click the field to add it to the Selected Fields list. If you
want to add all fields to your query, click the button with the double right arrows (>>).
c. When you have added all the fields that you want, click Next.
4. If you did not add any number fields (fields that contain numeric data), skip ahead to step 9. If
you added any number fields, the wizard asks whether you want the query to return details or
summary data.
a. If you want to see individual records, click Detail, and then click Next. Skip ahead to
step 9.
b. If you want to see summarized numeric data, such as averages, click Summary, and then
click Summary Options.
5. In the Summary Options dialog box, specify which fields you want to summarize, and how you
want to summarize the data. Only number fields are listed.
a. Sum The query returns the sum of all the values of the field.
b. Avg The query returns the average of the values of the field.
c. Min The query returns the smallest value of the field.
d. Max The query returns the largest value of the field.
6. If you want the query results to include a count of the records in a data source, select the
appropriate Count records in data source name check box.
7. Click OK to close the Summary Options dialog box.
8. If you did not add a date/time field to the query, skip ahead to step 9.
If you added a date-time field to the query, the Query Wizard asks you how you would
like to group the date values.
For example, suppose you added a number field ("Price") and a date/time field
("Transaction Time") to your query, and then specified in the Summary Options dialog
box that you want to see the average value of the number field "Price".
Because you included a date/time field, you could calculate summary values for each
unique date/time value, for each day, for each month, for each quarter, or for each year.
Select the time period that you want to use to group the date/time values, and then click Next.
Note: In Design view, you can use an expression to group by any time period you want, but the
wizard only offers these choices.
9. On the last page of the wizard, give the query a title, specify whether you want to open or modify
the query, and then click Finish.
If you choose to open the query, the query displays the selected data in Datasheet view. If you
choose to modify the query, the query opens in Design view
Task 32
Exercise on Create forms using Form Wizard.
The Form Wizard appears. Anytime you create a form, you must tell Access which table or query
you want to use for your form.
3. lick the Tables/Queries list arrow and select the table or query you want to use to create your
form.
4. Click the Tables/Queries list arrow and select the table or query you want to use to create your
form.
Now that you have specified the table, you need to tell the Wizard which fields you want to
display on the form. To add a field to the form, you can either double-click the field or select the
field and click the right arrow button.
Next the Form Wizard asks how you want to lay out the data on the form. There are a few
different layout options:
The Form Wizard creates the new form and displays it on screen.
Task 33
Exercise on Create reports using Report Wizard.
It's almost always easier to create and modify a report created by the Report Wizard than it is to create
one from scratch.
You can also create a blank report. Click the Create tab on the ribbon and click either the Blank
Report button (to create and display the report in Layout View) or the Report Design button (to
create and display a blank report in Design View).
The Report Wizard appears. Here, you need to specify the table or query that you want to use for
your report.
3. Click the Tables/Queries list arrow and select the table or query you want to use to create your
report.
4. Double-click the fields that you want to appear on the form and then click Next.
If you selected fields from more than one table, the Form Wizard would ask how you would like
to organize the data on your form; just make a selection and click Next.
Now you must specify the fields that you want to use in your reports.
5. Double-click any fields you want to group in the order you want to group them. Click Next.
6. Select the fields you want to use to sort your report and click Next.
You can click the button to the right of each list to toggle between ascending and descending sort
orders.
Now you need to specify your report's Layout and Orientation.
7. Select a Layout option and an Orientation option for the report, then click Next.
8. Give your report a name and click Finish.
The Report Wizard creates the new report and displays it on the screen.