IntroductionWelcome| 00:00 | (music playing)
| | 00:04 | Hi! My name is Adam Wilbert and I would
like to welcome you to Access 2013
| | 00:08 | Essential Training.
| | 00:09 | We'll start by taking a look at what
makes the relational database work, and how
| | 00:13 | moving your information into Access can
help make you more efficient with your
| | 00:17 | time and with your data.
| | 00:18 | We'll build tables to store our data
and attach rules to help minimize data
| | 00:23 | entry errors in order to ensure that
our data remains consistent and reliable.
| | 00:27 | Next, I'll introduce Queries, a
powerful way to find, filter and sort your data
| | 00:32 | in order to reveal exactly the
information you need precisely when you need it.
| | 00:37 | With forms we'll create a main
user interface to your database.
| | 00:41 | We'll build custom interactive
elements with buttons and combo boxes to help
| | 00:44 | us populate a database with data, and move
around to accomplish different tasks efficiently.
| | 00:50 | Reports will help us create a
structure for printed documents and allow us to
| | 00:53 | easily share insights about the data.
| | 00:55 | And finally, Macros will help us automate
tasks and keep everything running smoothly.
| | 01:00 | So thank you for joining me in
Access 2013 Essential Training.
| | Collapse this transcript |
| Using the exercise files| 00:00 | If you are a premium member of lynda.com
or watching these movies from a DVD,
| | 00:05 | you'll have access to the same
files that I am using here on screen.
| | 00:08 | You can copy the folder to your desktop
as I have done here or anywhere that is
| | 00:12 | easy for you to get to.
| | 00:13 | Inside the main folder are subfolders
for each chapter, and within those are the
| | 00:18 | files that I'll be using.
| | 00:19 | You'll see the name of the file display
across the bottom of your screen at the
| | 00:22 | beginning of each movie.
| | 00:24 | In some cases there will be a
completed version of the database file as well
| | 00:28 | that you can refer to if you'd like.
| | 00:30 | And a word of caution, because Access
saves changes to files automatically
| | 00:34 | while you're working with them, I
would highly recommend returning to a clean
| | 00:37 | and unaltered copy of the files if you
would like to work through and exercise
| | 00:41 | multiple times.
| | Collapse this transcript |
|
|
1. Getting StartedKey database concepts| 00:00 | Before we begin in Access, I think it's
important to outline a few key concepts
| | 00:05 | about what a database is and define
some of the keywords we will be hearing
| | 00:09 | throughout the course.
| | 00:10 | So what is an Access database?
| | 00:12 | An Access database is not
just a place to store your data;
| | 00:16 | it's a tool for creating custom
application that wraps the entire interaction
| | 00:19 | between you, your team, and the data.
| | 00:22 | Access is a collection of tools that
allow you to efficiently process data,
| | 00:26 | moving it in and out of the database,
maintain the quality of the data, and
| | 00:30 | ensure that it remains
consistently entered and valid.
| | 00:33 | Gain insight into the trends, areas of
opportunities and performance metrics
| | 00:38 | through a series of analytical
processes, construct organized and detailed
| | 00:43 | reports to help guide informed
decisions, and automate tasks to help prevent
| | 00:47 | processing errors and speed up workflows.
| | 00:50 | Simply put a well-crafted Access database
can give you way more than you put into it.
| | 00:55 | To do all of that, an Access
database uses five main components.
| | 00:59 | These components are collectively called
database objects, and each has a unique
| | 01:03 | role to play in managing your data.
| | 01:06 | The first object is a table.
| | 01:08 | Tables are where the data lives.
| | 01:10 | They provide a structured home
organized into fields and records.
| | 01:14 | The next objects are queries.
| | 01:15 | Queries are literally
questions that you have about the data.
| | 01:18 | Queries scour through your data
tables to find the answer to a question and
| | 01:22 | then return an answer as filtered or
calculate a list of records that look and
| | 01:26 | function just like a table.
| | 01:28 | Forms provide interactive
framework for your database.
| | 01:31 | They hold buttons for moving from task
to task, text entry fields, to help you
| | 01:35 | enter data into your tables and input
areas to help you define the parameters
| | 01:39 | for query or report.
| | 01:41 | Reports gather information from a
table or query and then format them for
| | 01:45 | a standardized page layout ready to be
printed, exported, or emailed to colleagues.
| | 01:51 | Finally, macro objects are sets of
programmatic instructions that you will create
| | 01:55 | to tell the database how to function
when you click on a button or interact with
| | 01:59 | a form or other object.
| | 02:01 | They can automate some fairly complex tasks.
| | 02:03 | It is the interaction of these five
components that makes the database function.
| | 02:07 | For instance, a form might help you
enter data into a table, a query will then
| | 02:12 | filter those records to a specific
subset, and then a report will format that
| | 02:16 | subset of records for printing.
| | 02:18 | To create our objects we will be
using multiple working modes called Views.
| | 02:23 | These can be grouped into two categories.
| | 02:25 | The standard view is the one you will
use when you are working with your data.
| | 02:29 | Depending on the object, we will use
Datasheet, Form, Report or Print Preview Views.
| | 02:35 | These will display our objects when
we are working with the information
| | 02:38 | contained within the database.
| | 02:39 | The other views are used when creating
or modifying the structure of the objects.
| | 02:43 | The Design, Layout, and SQL
Views all allow you to define how the
| | 02:48 | database functions.
| | 02:50 | Finally, it's important to understand the
relational structure of an Access database.
| | 02:55 | Take a look at the following
problematic table of contact phone numbers.
| | 02:59 | In this table, you will notice that
the first and last names are repeated
| | 03:02 | over-and-over again every time if there
is an additional contact phone number.
| | 03:06 | We can structure this data
differently but that introduces a new problem.
| | 03:11 | Now we have lots of blank cells where
individuals don't have a contact number of each type.
| | 03:15 | Further this table won't grow very well.
| | 03:18 | What if we wanted to add a fax number for
one individual or a second office number?
| | 03:22 | We would have to alter the structure of
the table to add an additional column to
| | 03:26 | accommodate those types of changes.
| | 03:28 | A relational database solves both problems.
| | 03:32 | Unlike a flat file database such as
an Excel spreadsheet, Access organizes
| | 03:36 | data into multiple tables that connect to
each other through common fields called keys.
| | 03:41 | Using the exact same data, we can
organize our phone numbers like this where
| | 03:45 | we have one table that's just about
people, and another table that's just
| | 03:49 | about phone numbers.
| | 03:50 | By linking the two tables together
with a key, in this case an employee ID, we
| | 03:55 | can accommodate growth and
prevent inefficiencies in our storage.
| | 03:59 | We can easily add new people or
additional types of contact numbers without
| | 04:03 | altering the structure of the tables.
| | 04:05 | We will expand in all of these
concepts throughout this course and we will be
| | 04:09 | creating several objects in each of
the five types, hooking them together to
| | 04:12 | build a relational database that will
efficiently store data, return answers to
| | 04:16 | our questions, perform
analysis, and generate reports.
| | Collapse this transcript |
| Launching Access and the Backstage screen| 00:00 | Starting Access for the first time is
pretty straightforward, we'll my move my
| | 00:04 | cursor up to the top-right corner and
then down to reveal the Search charm.
| | 00:08 | I'll click it and then type-in the word access.
| | 00:12 | The results get filtered and it
brings up the Access 2013 tile here.
| | 00:16 | I am going to press my Windows key
to return back to the Start menu.
| | 00:20 | Instead of going to the Search charm,
I can actually just start typing.
| | 00:23 | If I type-in access it automatically
jumps to Search and there is the tile again.
| | 00:28 | Now instead of clicking on it, which
will launch the program, I'm going to
| | 00:31 | right-click on it, which will
bring up additional options.
| | 00:33 | I can choose to Pin the tile to my Start window.
| | 00:37 | If I right-click again, I can choose
to Pin an icon to my Taskbar, which will
| | 00:41 | make it easy to get to Access from my Desktop.
| | 00:44 | I'll turn both of those options on.
| | 00:46 | Now I am going to press the Windows
key one more time and you'll see if I
| | 00:51 | scroll over here to the right, we've got
an Access tile here where we can start
| | 00:54 | the program quickly.
| | 00:55 | I am going to click and drag to move the Access
tile over to the beginning of my Start screen.
| | 01:00 | Now I have an easy way to launch Access.
| | 01:02 | Let's go ahead and click it.
| | 01:04 | When we switch into the
Desktop view an Access starts up.
| | 01:07 | If I look at my Taskbar down at the
bottom of the screen, we'll see an icon for
| | 01:12 | Access where we can get to it
quickly when the program is closed.
| | 01:16 | Now that our window is open we
can move it around the screen.
| | 01:19 | If I click and drag over here to the
right side, I can launch Access and attach
| | 01:23 | to the right side of my screen.
| | 01:25 | If I drag it over to the left, it will
fill up the left-half of my screen, and
| | 01:30 | if I want to go full screen I simply drag
it to the top and Access will go full screen.
| | 01:35 | Now that we've got Access up and
running and our window arranged how we like,
| | 01:38 | we can start to create our first database.
| | Collapse this transcript |
| Creating the database file| 00:01 | Unlike other Office programs that
immediately give you a blank document to get
| | 00:05 | started in, Access starts with the
options for creating a new database, or
| | 00:08 | opening an existing database.
| | 00:10 | On the first screen we'll see a list
of available starting templates here.
| | 00:14 | We have templates for Assets,
Business, Contacts, and so on;
| | 00:18 | above that we have a box, so
we can Search for templates.
| | 00:20 | I'll click here and type vehicle.
| | 00:23 | When I press Enter, Access searches
through the available templates online and
| | 00:27 | returns this Desktop Vehicle
maintenance database template.
| | 00:31 | If I am interested in it, I can click
on it to get some additional information
| | 00:35 | such as how big the file is, what kind
of rating it's gotten from other users.
| | 00:39 | And if I decide to use this, I
simply give it a name and press Create.
| | 00:43 | Access will download this template to
my computer and I can begin using it.
| | 00:46 | I am going to press the Close
button on the upper right-hand corner to
| | 00:50 | dismiss this window.
| | 00:51 | Then I am going to press the Back button
here at the top left to return to the beginning.
| | 00:57 | Now any of the templates that use the
web app phrase like the Custom web app
| | 01:00 | here or the Globe icon such as this
Context template, these templates use
| | 01:06 | the web-based SharePoint servers to host your
database and make it available over the Internet.
| | 01:11 | In order to create a web app
database you'll need access to a self-hosted
| | 01:15 | SharePoint server or have an active
subscription to either Microsoft Office 365
| | 01:20 | Small Business Premium,
or Office 365 Enterprise.
| | 01:24 | For more information about
Office 355 Plans & Pricing visit
| | 01:28 | office365.microsoft.com.
| | 01:31 | In this course we are going to
focus on the desktop database.
| | 01:34 | These types of databases allow you to
create self-contained databases that run
| | 01:38 | right from your local computer or
network without the added complexity of
| | 01:41 | managing servers or subscriptions.
| | 01:44 | These tablets are great if you just
want to get up and running with the task
| | 01:48 | of storing your data, but they are also a
great resource for learning about how Access works.
| | 01:52 | Some of them include very
sophisticated layout ideas and techniques that can
| | 01:56 | help give you ideas of the things
that you can add to your own databases.
| | 01:59 | So even if you don't need an asset-tracking
database, for example, it might be
| | 02:03 | worthwhile to spend a few minutes exploring
the template, taking it apart to see how it works.
| | 02:09 | If you don't want to start with a
template the left-hand side of the screen has
| | 02:13 | a listing of Recent files, if you have
opened any previously, and we also have an
| | 02:17 | option to Open Other Files,
go ahead and click there.
| | 02:21 | This will bring up a new window, we can
choose to create a new database, open an
| | 02:25 | existing database from our computer,
checkout our account settings or explore
| | 02:31 | some Access options.
| | 02:32 | Let's start a new database by clicking
on the blank database icon, and I go back
| | 02:36 | to New and choose this Blank desktop database.
| | 02:41 | Access asks us for a name for our database.
| | 02:43 | I am going to call this NoObstacles.
| | 02:45 | We are going to create a
database for the NoObstacles Home and
| | 02:48 | Furnishing Company.
| | 02:49 | Go ahead and click on the folder icon to
choose where we are going to save this database.
| | 02:53 | I am going to browse out to my Desktop.
| | 02:55 | I am going to find my exercise files
folder and I am going to go into the
| | 03:01 | Chapter 01 folder and say Open,
and then OK to save my database.
| | 03:06 | Access updates the path here and now I press
the Create button to create the new database file.
| | 03:12 | Access creates this file and opens
up a new Data Table ready for us to
| | 03:16 | start entering our data.
| | 03:18 | Now that we have got our database
file created, we can begin to explore
| | 03:21 | the Access interface.
| | Collapse this transcript |
| Understanding the Trust Center| 00:00 | All Access database files have the
potential to contain dangerous or malicious
| | 00:04 | code buried within embedded
macros and Visual Basic routines.
| | 00:08 | If you are unsure of a database's
origins, you should be very careful about
| | 00:12 | allowing them to run before you've
had a chance to check them out and make
| | 00:16 | sure that they are safe.
| | 00:17 | Because of this, Access requires you to
give specific permissions to a database
| | 00:21 | file before we'll activate and
run any code within the database.
| | 00:25 | When opening a new file for the first
time Access will display this yellow
| | 00:29 | security warning across the top.
| | 00:31 | There are couple of things that
we can do to handle this warning.
| | 00:34 | First, I can click on the X on the
top-right to dismiss the warning.
| | 00:38 | Access will continue to let us work, but
it won't run any macros or code modules.
| | 00:43 | This could prevent the
database from functioning properly.
| | 00:45 | If I click the Enable Content button to
trust this particular file, Access will
| | 00:51 | remember this file and it won't ask
us again the next time we work with it;
| | 00:55 | or I can click on the text here, when I
hover over it becomes underlined, I'll
| | 00:59 | click on it to get some additional options.
| | 01:01 | We've got a Security Warning box here,
where we have links to the Trust Center
| | 01:06 | Settings and links to Learn
more about Active Content.
| | 01:10 | The Enable Content button here, if I
click it, we can enable the content for our
| | 01:14 | database or we can get to some Advanced Options.
| | 01:17 | I am going to click on Enable All Content.
| | 01:20 | Now our database is trusted and code will run.
| | 01:23 | Trusted documents are files that you've
previously granted Access permission to run.
| | 01:27 | We can also trust a location on our
computer and then any files in that location
| | 01:31 | will automatically be trusted as well.
| | 01:33 | Let's go ahead and trust the lynda.com
exercise files location so that we aren't
| | 01:38 | bothered with the security message
throughout the remainder of the course.
| | 01:41 | I am going to go up to the File tab and
then down to Options that will bring up
| | 01:47 | the Access Options window.
| | 01:48 | The very last option on the left is
Trust Center, and then on the right side of
| | 01:52 | that, Trust Center Settings.
| | 01:54 | At the top of the next screen we
have an option for Trusted Locations, go
| | 01:59 | ahead and click that, and you'll see
a list of all the locations that have
| | 02:02 | previously been trusted.
| | 02:03 | Let's go ahead and add our location here.
| | 02:06 | I'll press the Add the new location
button and then browse out to my exercise
| | 02:10 | files folder location.
| | 02:12 | I'll click Browse, go out to my
Desktop and then go into my Exercise Files
| | 02:18 | folder, I'll press the OK button to select it.
| | 02:22 | Make sure you check the subfolders
of this location are also trusted.
| | 02:26 | Now any files in that folder or
within subfolders within that folder, are
| | 02:30 | automatically trusted as safe.
| | 02:33 | Go ahead and press the OK button, I'll
press OK again, and I'll press OK one
| | 02:38 | more time to close the Access options.
| | 02:41 | Now if I close this file and reopen it,
we won't be prompted to trust it again.
| | 02:45 | Opening databases that you created
yourself, or ones that come from reputable
| | 02:49 | sources, usually won't pose much of a threat.
| | 02:52 | But if you are ever unsure about who
created a particular database file it's
| | 02:56 | best to play it safe, and explore its
contents before allowing it to run any
| | 03:00 | code on your computer.
| | Collapse this transcript |
| Digging in to Ribbon tabs| 00:01 | All of the tools that we will be using
in Access are organized into the same
| | 00:05 | Ribbon tab layout that is used
throughout the Microsoft Office Suite.
| | 00:08 | These are contextual tabs that run
along the top here that change depending on
| | 00:12 | the context of what you're working on.
| | 00:14 | By default there are four main ribbons,
plus the File tab which takes you to
| | 00:18 | the backstage options.
| | 00:19 | Let's take a look at each tab and
get a peek at their organizations
| | 00:22 | starting with that file tab.
| | 00:24 | Now when I click on it, you'll notice
it's not really a ribbon at all, it takes
| | 00:28 | you to the screen called backstage view.
| | 00:30 | This where you can Open a new file,
Save existing objects, Close the database,
| | 00:36 | you can also get information about
your current user Account and get to those
| | 00:39 | Access Options and I click the back
button on the top to return to the
| | 00:43 | standard interface.
| | 00:45 | The rest of the tabs, Home, Create,
External Data and Database Tools all have a
| | 00:51 | similar and familiar layout.
| | 00:53 | We have objects called Command
buttons that are organized into groups.
| | 00:57 | On the Home tab for instance, we have
groups for View, Clipboard, Sort & Filter,
| | 01:02 | Records, Find and Text Formatting.
| | 01:05 | And then within these groups are the commands.
| | 01:07 | For instance in the Clipboard group, we
have Paste, Cut, Copy and our Format Painter.
| | 01:13 | The Sort & Filter group has options
for sorting and filtering records.
| | 01:17 | The Records group has options
for adding and deleting records.
| | 01:21 | The Find group has where you'll find,
Find and Replace options, and the
| | 01:24 | Formatting group has Bold, Italic,
Underline and other text formatting options.
| | 01:30 | The next tab over is the Create tab.
| | 01:32 | Let's go head and click that and we'll
see we have groups for Tables, Queries,
| | 01:37 | Forms, Reports and Macros & Code.
| | 01:40 | These are all the different objects
that we'll be creating in our database.
| | 01:43 | We'll be spending a lot of time here
in this tab throughout this course.
| | 01:47 | The next tab is External Data.
| | 01:49 | The External Data tab is all about
bringing data in with the important link
| | 01:52 | section and out with export section.
| | 01:55 | You'll see we have lots of options,
for instance, we can Import from an Excel
| | 01:59 | file, or we can Export to a PDF
file, there are lots of options here.
| | 02:04 | Finally the Database tools and we have
some specialized tools for maintaining
| | 02:07 | the database and its components.
| | 02:09 | Additional tabs will pop up when
working with specific objects, for
| | 02:12 | instance, when we start working with
Tables in the next chapter, we'll see a
| | 02:16 | setup tabs specific to tables.
| | 02:18 | Now if you are working on a small
screen such as a tablet computer, you might
| | 02:22 | find that the ribbon takes
up a lot of your workspace.
| | 02:24 | You can collapse the ribbon by
pressing the up arrow on the right side here.
| | 02:28 | That will collapse my ribbon so
all I see is the text of the tab.
| | 02:32 | When I want to get to a command
button, I'll simply press the tab and the
| | 02:36 | command buttons appear.
| | 02:37 | I'll select what I want and then
the ribbon will disappear again.
| | 02:41 | Once the ribbon is collapsed though,
it's not really clear on how to get it back.
| | 02:44 | You can open the ribbon again and I
click on this pin icon over here on the
| | 02:48 | right to lock it open again.
| | 02:50 | Another way you can do it is to
double-click on an active tab, for instance
| | 02:54 | External Data is active right now.
| | 02:55 | If I double-click on it, the ribbon
will close, double-click again, and
| | 02:59 | the ribbon locks open.
| | 03:00 | And if you like keyboard shortcuts,
the Ctrl+F1 key will minimize or reveal
| | 03:04 | the ribbon contents.
| | 03:06 | One more ribbon trick before we wrap up.
| | 03:08 | The scroll wheel on your mouse can
be used to scroll through the ribbons.
| | 03:11 | I can scroll backwards and
forwards using that wheel.
| | 03:14 | Simply move your mouse cursor over
the ribbon area and scroll up and down.
| | 03:18 | I'll be honest though,
| | 03:19 | I accidentally scroll the wheel up
here all the time and then wonder why the
| | 03:22 | ribbon switched on me.
| | 03:23 | If that's ever happened to you, now you know
why, you probably just bumped the scroll wheel.
| | 03:28 | Now the ribbons have all the tools that
we'll want to use to design and develop
| | 03:32 | our database applications.
| | 03:33 | Getting used to their organization
will be key in being able to quickly get
| | 03:37 | to the items you need.
| | Collapse this transcript |
| Using the Navigation pane| 00:00 | The Navigation panel on the left-side
of your screen here is the Table of
| | 00:04 | Contents for your database.
| | 00:05 | It displays all the objects, the Tables,
Queries, Forms, Reports & Macros that
| | 00:10 | make up this database.
| | 00:12 | It also allows you to filter and search
through those objects to get to the ones
| | 00:15 | you are looking for quickly.
| | 00:16 | Right now the Navigation pane
is in its default configuration.
| | 00:20 | It says All Access Objects across the top.
| | 00:23 | And I'm going to actually open this up a
little by clicking and dragging open to
| | 00:27 | make it little wider.
| | 00:28 | Below, we have a search box, so we can
type in to filter the list of objects.
| | 00:32 | I'm going to click here and type phone
to see all of the objects that have the
| | 00:36 | word phone in their name.
| | 00:37 | When you want to clear the search,
click on this filter icon to the right and
| | 00:41 | that will clear the search string
and return you to viewing all objects.
| | 00:44 | Below each of the objects are
listed under a collapsible type header.
| | 00:48 | Click on the up arrows to the
right to collapse the group.
| | 00:50 | I can collapse of Tables here,
then Queries, Forms and Reports.
| | 00:56 | If I want to work with my Query objects
I can simply open it again, use the one
| | 00:59 | I want and then close it when I'm done.
| | 01:02 | I'm going to go head and expand all these again.
| | 01:05 | At the top of the Navigation pane
there is a dropdown menu that allows us to
| | 01:09 | change the configuration of the pane, here.
| | 01:12 | This menu is separated
into two different groups.
| | 01:15 | The top one says Navigate To Category,
and I personally think this should just
| | 01:20 | simply read grouping, because
that's exactly what it does.
| | 01:23 | We can choose an option in the top
half to change the way the objects
| | 01:26 | are grouped together.
| | 01:27 | Right now they're grouped by Object Type,
but I can group them by Custom group,
| | 01:31 | by Tables and Related groups, based off
of the Date they are Created or the Date
| | 01:36 | they were last Modified.
| | 01:38 | The bottom half of the menu says Filter
By Group, here we can choose to display
| | 01:43 | only a single object type.
| | 01:44 | I'll click Tables to filter my navigation
pane to show just the tables in my database.
| | 01:49 | You'll notice that the top now reads
Tables, instead of All Access Objects.
| | 01:53 | I'll change it back in the dropdown,
down here to All Access Objects, to
| | 01:57 | view everything again.
| | 01:58 | There is also a right-click menu at the top
of the Navigation pane with some more options.
| | 02:03 | I'll go up here and right-click,
you'll see we have the same categories and
| | 02:07 | sorting options, we can also sort
Ascending or Descending alphabetically.
| | 02:11 | We also have a View By option where I
can choose how I want to view my objects.
| | 02:16 | Right now they are in List view
which is a small icon in the text.
| | 02:20 | I can change it to Details to view
a larger icon and some additional
| | 02:23 | information about each object.
| | 02:24 | I'm going to go back up and right-click, go
to View By, and change it back to List.
| | 02:30 | If you want even more options, you can
go in the Navigation options button here.
| | 02:34 | This will give us a really detailed
look at what options are available for
| | 02:37 | organizing our Objects menu, go ahead
and say OK, and finally in that same menu,
| | 02:43 | go back up and right-click, we
get turn on and off our search bar.
| | 02:47 | So if you don't use it,
you can turn it off here.
| | 02:50 | If you want to get the Navigation pane
out of your way, you can use this Shutter
| | 02:54 | Bar button here to the right.
| | 02:56 | If you click it once, the Navigation
pane collapses to the left, if I click it
| | 03:00 | again, it opens up again.
| | 03:01 | Now one of the most useful keyboard
shortcuts in all of Access is the F11 key.
| | 03:05 | This will collapse and
reveal the Navigation pane.
| | 03:07 | If I press F11, you'll see it
shrinks down and it opens up again.
| | 03:12 | Using F11 you can quickly open up the
pane when you need it, then get it off the
| | 03:15 | screen so you have more room to work.
| | 03:18 | So that's the Navigation pane.
| | 03:20 | It's the central hub to the entire database.
| | 03:22 | Getting around your objects using the
Navigation pane is really easy, and with
| | 03:26 | so many options to Group, Sort and
Filter your objects to meet your exact
| | 03:30 | needs, means that you can be moving
around from object to object in the most
| | 03:34 | efficient manner possible.
| | Collapse this transcript |
| Using the Quick Access Toolbar| 00:00 | The Quick Access toolbar is a set of
persistent tools that stay at the very
| | 00:04 | top of your screen.
| | 00:05 | By default they have
options for Save, Undo and Redo.
| | 00:10 | There is also an option to change the spacing
of your command buttons on your ribbon tabs.
| | 00:13 | I will click this and see that
it's currently set to Mouse view.
| | 00:17 | I can change it to Touch mode, which
will increase the spacing, which is perfect
| | 00:20 | if you are running Access on a Tablet.
| | 00:22 | I am going to change this back to Mouse.
| | 00:24 | I can add additional commands to the Quick
Access tool bar by clicking this down arrow here.
| | 00:29 | For instance, I can choose Print
Preview to add that to the bar.
| | 00:32 | If I want even more options, I will click
the down arrow and choose More Commands.
| | 00:37 | That will bring up a window that lists
all of the commands available in Access
| | 00:41 | on the left and the commands I have
selected to include on the Quick Access
| | 00:44 | toolbar on the right.
| | 00:45 | I am going to choose from the
Popular Commands, I will change that to All
| | 00:49 | Commands and then I will
scroll down until I find Save As.
| | 00:52 | I will click it and then press Add,
to add that to my Quick Access toolbar.
| | 00:57 | If I want to rearrange these, I can
use the buttons over here on the right.
| | 01:01 | I'll select Print Preview and move
that up so it appears right after Save As.
| | 01:06 | Go ahead and press OK to save those
changes and you will see the Quick Access
| | 01:10 | toolbar changes to include the commands
that you want to have front and center.
| | Collapse this transcript |
| Signing in to Microsoft Live| 00:00 | If you have a Microsoft Live account,
you can log into your account right from
| | 00:04 | inside Access in order to sync
files across multiple computers.
| | 00:08 | To do that, you go to the Sign in link in
the upper right-hand corner of your screen.
| | 00:12 | I will click there and
choose my Microsoft account.
| | 00:16 | Go ahead and type in your Username and
Password and press the Sign in button.
| | 00:21 | If you haven't signed in from this
computer before, there might be an
| | 00:24 | additional step to verify your identify,
but once you have signed in, you will
| | 00:29 | notice your ID photo in the upper right
hand corner and your name here showing
| | 00:33 | that you are logged in.
| | 00:34 | Now we can go up to the File tab
and press Open and see that I have got
| | 00:39 | access to all the files that I have currently
saved within my online hosted SkyDrive folder.
| | 00:44 | Logging into your Microsoft Live
account allows you to sync files easily
| | 00:48 | across multiple computers.
| | Collapse this transcript |
| Taking backups| 00:00 | When working inside of your Access
databases, it's really important to make sure
| | 00:04 | that you've always got of
backup in case something goes wrong.
| | 00:08 | Access makes a super easy to create a backup
file, so it's really no reason to not have one.
| | 00:13 | In order to create a backup, we'll go up
to the File tab, and I go down to Save As.
| | 00:17 | There is an option here called Back Up
Database, I'll select that and choose Save As.
| | 00:24 | Access brings up my Save As dialog box
and notice that it's suggested a File
| | 00:28 | Name of our original database, plus
the word Backup, plus today's date.
| | 00:33 | I simply needed to press Save and Access
creates a backup of my file saved on my
| | 00:38 | hard drive and that's all there is to it.
| | 00:41 | I can safely proceed with editing my
database and know that I've got a backup in
| | 00:45 | place if something goes wrong.
| | Collapse this transcript |
| Accessing help| 00:00 | Sometimes you'll need additional assistance
when you are trying to accomplish a specific task.
| | 00:05 | The Microsoft Office Help documentation is a
great resource to have at your finger tips.
| | 00:10 | You can get to it by clicking on this
question mark icon on the top right of
| | 00:14 | your screen or pressing
the F1 key on your keyboard.
| | 00:16 | When you launch Help, you get a
document that looks like this with links to
| | 00:20 | Popular Searches, such as for
Criteria or Queries. Getting Started;
| | 00:25 | you can find out some
information about What's new is Access.
| | 00:28 | We have linked keyboard shortcuts, which is
a handy reference to have up on your screen.
| | 00:32 | When you get done with this, you can press the
Home key here to get back to the main screen.
| | 00:37 | We can take a look at Basics and Beyond,
which has options for Introduction to
| | 00:41 | tables and Introduction to queries.
| | 00:44 | One handy button here on the Help
screen is this Pin icon here; when you press
| | 00:48 | this Pin, Access keeps the Help
document on top of your screen, so I can switch
| | 00:53 | back into Access and continue working
with my database without the Help document
| | 00:57 | hiding in the background.
| | 00:59 | The Access Help document is a great
resource when you need additional help in
| | 01:03 | creating your objects or for
learning about how different functions work.
| | Collapse this transcript |
|
|
2. Creating TablesUnderstanding table structure and relationships| 00:00 | Tables provide the foundation for any
good database and the success of the
| | 00:05 | database, how well it functions, and
how flexible it is to future growth often
| | 00:08 | comes down to the structure of
tables that you house your data.
| | 00:11 | Understanding how tables function
in Access is a key to creating a well
| | 00:15 | structured database.
| | 00:16 | Tables in Access follow a very strict model.
| | 00:19 | Their horizontal rows are called records.
| | 00:22 | Records are an unbroken chain of
properties that describe a single entity.
| | 00:25 | For instance, in an employee's table, you
have a record for each individual in the company.
| | 00:31 | Fields are the vertical columns.
| | 00:34 | Each field in a table is a single
property that is being tracked for each record.
| | 00:39 | Each field can hold data of a single data type.
| | 00:43 | You can choose to store short text
which are up to 255 characters, long text
| | 00:49 | with a maximum character limit of 65,000.
| | 00:51 | This is useful for comments or memos.
| | 00:54 | Numerical values that you perform
mathematical calculations with, these can
| | 00:58 | be set to integers only or can include
decimal values. Date and time or currency values.
| | 01:04 | AutoNumber fields creating incrementing
serial number field that Access creates
| | 01:10 | for you when new records are added to the table.
| | 01:12 | Yes/No is a binary field, it can be
Yes/No, True or False, or On or Off.
| | 01:19 | OLE object is an older format used for
attaching files such as images or Word documents.
| | 01:24 | If you need to attach files, I recommend
using the newer and much more efficient
| | 01:29 | attachment data type.
| | 01:30 | Really the OLE object data type is just
kept around for backwards compatibility,
| | 01:34 | and probably shouldn't be used at this point.
| | 01:37 | If you'd rather not import files into
the database, you can choose to use a
| | 01:41 | hyperlink data type and
provide a link to external content.
| | 01:44 | This could be files on your network,
email addresses, or locations on the Internet.
| | 01:49 | Finally, the calculated value creates
data by calculating it from one or more of
| | 01:53 | your other fields, and a Lookup Wizard
will help you create a dropdown list to
| | 01:57 | limit the available entries.
| | 01:58 | In addition to the fields that
describe each record's properties, we will also
| | 02:02 | create fields that link tables together.
| | 02:05 | Previously, I've mentioned that
Access stores data in related tables.
| | 02:09 | Because of this, each record of the
table needs to be uniquely identifiable.
| | 02:13 | In order to ensure that this is the
case, we will create a field specifically
| | 02:17 | for this purpose called the primary key.
| | 02:19 | The primary key is typically a
serial number or other unique identifier.
| | 02:24 | Think about how many unique identifiers
you have for the various databases that
| | 02:28 | you personally appear in.
| | 02:30 | You probably have a driver's license
number, a library card number, a Social
| | 02:34 | Security number, a checking account number;
| | 02:36 | the list goes on and on.
| | 02:38 | The reason all of these systems use
serial numbers instead of just your name;
| | 02:41 | so that they can guarantee a unique individual.
| | 02:44 | It wouldn't be very nice if one Mary
Smith had to pay a fine for another Mary
| | 02:48 | Smith's overdue library book, just
because a library couldn't tell them apart.
| | 02:53 | The primary key will also be our link to
finding related records in additional tables.
| | 02:58 | In a related table they
will be called the foreign key.
| | 03:01 | The process of breaking your data into
related tables is called normalization.
| | 03:05 | Normalization rules fall into
several categories called normal forms.
| | 03:10 | Your database is set to satisfy the
first normal form or 1NF, if all of the
| | 03:15 | cells contain only a single value.
| | 03:16 | Rather than have a single employee
name field, we should break that into
| | 03:20 | separate first name and last name fields.
| | 03:23 | Breaking addresses into separate
street, city, state, and zip code fields is
| | 03:27 | another common example.
| | 03:29 | The second normal form states that
only data that is dependent on the primary
| | 03:33 | key belongs in that table.
| | 03:35 | We wouldn't want to store information
about the customers each employee has
| | 03:38 | helped in the employee's table.
| | 03:40 | Instead we should create a new table
that describes the interaction between our
| | 03:43 | employees and our customers.
| | 03:45 | The third normal form states that data
that can be calculated or derived from
| | 03:49 | other fields should not
be stored in the database.
| | 03:52 | We wouldn't want to create a field for
employee initials for example, because we
| | 03:56 | can easily calculate them by taking the
first letter from the first name field
| | 04:00 | and the first letter from the last name field.
| | 04:03 | Tables are where your data lives, and
are the foundation for your database.
| | 04:07 | Creating a strong foundation as a base,
then growing your database on top, with
| | 04:11 | the addition of queries, forms, and
reports, will mean your database will be able
| | 04:15 | to be flexible and efficient.
| | Collapse this transcript |
| Creating a table and setting data types| 00:00 | When creating a place for our data to
live, we will define the columns or fields
| | 00:04 | that will house the data.
| | 00:06 | Remember that in a properly normalized
data table the fields will represent the
| | 00:09 | smallest piece of information possible.
| | 00:12 | So instead of a single name field, we
will instead break it out into a first
| | 00:15 | name, last name, or even middle name,
suffix, and prefix fields if needed.
| | 00:20 | Let's create a table to hold
information about the NoObstacles
| | 00:23 | companies customers.
| | 00:24 | Now there are a couple of different ways
to create a new table in Access, all of
| | 00:28 | which can be found in a Create tab.
| | 00:30 | Here in the Tables group, this
SharePoint option will create tables on
| | 00:34 | a SharePoint server.
| | 00:35 | The other two options are
what we are looking for.
| | 00:38 | We can create a table in either
Datasheet view, this option here, or in Design
| | 00:42 | View with this button.
| | 00:43 | Let's start creating our customer
table in Datasheet view by clicking on
| | 00:47 | the Table button here.
| | 00:48 | Access will create a new table for us
and sets up the first column named ID.
| | 00:53 | If I click on it, I can take a look up
here in the Data Type to see if that is
| | 00:59 | an AutoNumber field.
| | 01:00 | The AutoNumber field is a serial number
that Access creates for us automatically.
| | 01:04 | Now I want to be specific about what
type of data this field is holding, so
| | 01:07 | instead of just ID, I am
going to name it Customer ID.
| | 01:10 | I will double-click on the Text ID
to rename it and type in CustomerID.
| | 01:16 | Go ahead and press tab
to move to the next field.
| | 01:20 | The next field is going
to be our first name field.
| | 01:22 | It's going to be text, so I will choose
from the list, Short Text, and then give
| | 01:27 | it a name, FirstName.
| | 01:30 | Go ahead and press Tab or Enter to
move to the next field, and this time I am
| | 01:35 | going to keep my hands on the keyboard.
| | 01:37 | I can use the up and down arrow keys to
move to the list of available options.
| | 01:41 | I can move from Short Text to Number, Currency,
Date & Time, Yes/No, Lookup & Relationships.
| | 01:47 | I can choose Rich Text fields, Long
Text fields, I can choose to Attach files
| | 01:51 | in this field, or create a Hyperlink,
and finally, I have some options for
| | 01:55 | Calculating Fields.
| | 01:57 | I can also press the underlined
letter to jump straight to a field.
| | 02:01 | So for instance, if I want to go back to
the Short Text, I'll simply press the T key.
| | 02:05 | Now I will give it a name,
this is our LastName field.
| | 02:09 | Notice that when I am naming my
fields, I am not using any spaces here.
| | 02:13 | Now Access will totally allow you to use
a space in the names, it's okay with that.
| | 02:17 | But as a standard user interface
convention, I tend to use camel casing, which
| | 02:21 | means all the words run together and we
capitalize the first letter of each new word.
| | 02:26 | I'm sure you'll find the
convention that works for you.
| | 02:28 | As long as you're consistent
that's really all that matters.
| | 02:30 | Let's take a look at the ribbons now.
| | 02:33 | Notice that while we are working with the
tables, we've got two new tabs up here at the top.
| | 02:38 | They are into the Tables tools group;
| | 02:40 | we have got Fields and Table.
| | 02:41 | Within the Fields tab we have Groups
to Add new fields here, Add & Delete.
| | 02:45 | We can change the Properties for our
fields here, we can change the Formatting
| | 02:48 | for those Text Fields and we
can set up some Validation rules.
| | 02:52 | I am going to add another
field here for my phone number.
| | 02:55 | Now you might think that you are going
to use this number button here in the Add
| | 02:59 | & Delete group, to add
in the Phone Number field.
| | 03:02 | But a phone number is actually
going to be added as Short Text.
| | 03:05 | Phone numbers aren't something
that we are going to be mathematically
| | 03:07 | calculating or deriving from.
| | 03:09 | You are not going to add two
phone numbers together for instance.
| | 03:12 | Plus for a phone number field, we want
to store the parentheses and hyphens,
| | 03:16 | the punctuation marks.
| | 03:17 | Remember, Short Text could be
good for alpha and numeric data.
| | 03:21 | I am going to press that
button and it adds a new field over.
| | 03:25 | Now we can give it a name, I am going
to call it CustomerPhone and press Enter.
| | 03:31 | Now I don't want to add anymore fields
here, so I am just going to go ahead and
| | 03:36 | save the construction of my table.
| | 03:37 | Up here on the Quick Access
toolbar, I have got a Save icon.
| | 03:40 | This is purple disc, I will go ahead and click
that and it brings up the Save As dialog box.
| | 03:45 | You can also use the standard Windows,
Ctrl+S shortcut key to bring up the
| | 03:49 | Save As dialog box.
| | 03:50 | We are going to go ahead and give our
customers Table the name, Customers and
| | 03:54 | press OK to save it.
| | 03:56 | You will notice that it updates over in
the Navigation pane on the left, now our
| | 04:01 | database is beginning to take shape.
| | 04:02 | We have a table created where we can begin
to collect information about our customers.
| | 04:06 | Access created a primary key for us
with this ID field and we added three text
| | 04:11 | fields to hold the last name, the
first name and the customer's phone number.
| | Collapse this transcript |
| Entering data| 00:00 | Adding new records to your database
is as easy as filling in the blanks.
| | 00:04 | Each Record or horizontal row will
contain information about a single entity.
| | 00:08 | In our case the Customers Table will
collect information about our individual
| | 00:12 | customers with each row
containing information about one customer.
| | 00:16 | Let's start to put a couple
of records into our database.
| | 00:19 | I am going to open up the Customers
Table we created in the last movie.
| | 00:22 | I'll double-click on it in
the Navigation pane to open it.
| | 00:25 | I am going to add three new customers
here, the first field is the CustomerID
| | 00:30 | that's the AutoNumber ID
field for our customers.
| | 00:33 | If I try and type something here, I'll
get a warning beep and a message down
| | 00:37 | along the bottom that says
that the Control cannot be edited;
| | 00:40 | it's bound to an AutoNumber field.
| | 00:42 | Access is going take care of the
serial numbering of all of our customers for
| | 00:46 | us, so that we don't need to keep track of that.
| | 00:48 | I am going to tab to go to the next
field, the FirstName field, and enter in
| | 00:53 | Evan, our first customer.
| | 00:56 | I'll press tab again to go the next
field, this is our LastName field,
| | 00:59 | his LastName is Santos.
| | 01:01 | I'll press tab one more time to get to
the Phone Number field and I am going to
| | 01:06 | type in his Phone number, (383)835-9398.
| | 01:09 | When you get done entering the record,
you can press tab one more time or press
| | 01:13 | the Enter key, to move down to the
next record and we will start entering in
| | 01:16 | our second customer.
| | 01:18 | I'll skip the ID field, press tab
again, this customer is Micah Harvey, and
| | 01:24 | Micah's Phone number is (564) 618-7716.
| | 01:29 | When you get done entering that record,
press Return or Enter one more time.
| | 01:33 | Our last Customer is Dante Levy and
Dante's Phone number is (636) 920-1555.
| | 01:44 | Now if you want to move back and
forth between the records, you can press
| | 01:46 | the arrow keys to move left and right, or
up or down, to move around in your records.
| | 01:52 | We can also use the button down here at
the very bottom of our table to navigate
| | 01:55 | through the records.
| | 01:56 | Like I have options to go to the first
Record here, or go to the Last record.
| | 02:01 | I can move back and forth single
records by pressing the Previous record button
| | 02:05 | or the Next record button.
| | 02:07 | In the middle here we have
the Current Record indicator.
| | 02:10 | This information tells me what record
number we are on in the Table and how many
| | 02:15 | total records there are on the table.
| | 02:16 | Right now, it says 3 of 3.
| | 02:18 | I'm on the third record of
three records in this table.
| | 02:22 | This last button over here with the yellow
starburst will jump us to a new blank record.
| | 02:26 | Now we only have three customers
currently, if I wanted to add a fourth, it's
| | 02:30 | really easy for me just to go to
this fourth line and start typing it in.
| | 02:33 | But imagine you have a table with 10,000
records in it, pressing this button as
| | 02:37 | a shortcut, instead of having to
scroll all the way to the bottom before you
| | 02:40 | enter in your new information.
| | 02:42 | We are going to talk about the
Filter and Search boxes in a later movie.
| | 02:46 | Now it's worth noting here that
Access is saving all of these record
| | 02:49 | entries automatically.
| | 02:50 | As soon as we finish typing in one
record and move to the next, Access saves
| | 02:54 | that record to the database, so we
never have to worry about losing data.
| | 02:58 | The only time you need to save the
database is when you're making changes to
| | 03:02 | the structure of it, to the design of
tables or forms or the connections, for example.
| | 03:06 | Whenever you're strictly entering or
modifying the data that lives in the
| | 03:09 | database, you don't have to think
about saving, your data will be safe and
| | 03:13 | sound in the Access file.
| | 03:15 | I can go ahead and close the
Customers Table and you'll see that Access
| | 03:18 | doesn't prompt us to save.
| | 03:20 | If I double-click on it to open it
again, you'll see that our records are
| | 03:23 | there safe and sound.
| | 03:24 | Now once your tables are created,
entering data can be as simple as typing
| | 03:27 | into the blank cells.
| | 03:28 | Later in the course we will see how
we can add additional controls on these
| | 03:32 | cells to help prevent data entry error,
such as typos and help automatically
| | 03:36 | control formatting, such as
automatically adding the parentheses around our area
| | 03:40 | codes in phone number field.
| | 03:42 | We also saw where to look to get some
basic information about the contents of
| | 03:46 | our table, such as the currently
selected record and how many records it
| | 03:49 | holds, down here.
| | 03:52 | Anytime I open up a new table, my eyes
instinctively flick down to this little
| | 03:56 | box for quick and easy summary of the contents.
| | Collapse this transcript |
| Understanding primary and foreign keys| 00:01 | In a well-designed database, you'll
create many tables that relate back to
| | 00:04 | records in other tables.
| | 00:05 | If you have data that isn't
specifically about the primary theme of the table,
| | 00:09 | it's probably the case that it
should go into another table.
| | 00:12 | For instance, let's suppose we want
to sort credit card information in our
| | 00:16 | database; here's a couple of questions
that you might ask in determining where to
| | 00:19 | store the credit card data.
| | 00:21 | Does the credit card number
describe our customer? No, not really.
| | 00:26 | Will every customer want us to remember
their credit card number? Probably not.
| | 00:30 | Will some customers have
multiple credit cards on file with us?
| | 00:33 | Yeah that's a possibility.
| | 00:35 | So credit card numbers are not
specifically about a customer.
| | 00:38 | Some customers won't have any
and some customers will have many.
| | 00:42 | All of these answers lead me to
conclude that customer credit card numbers
| | 00:46 | should be stored in a
different table from our customers.
| | 00:49 | Let's create a new table to store a
credit card information and then create the
| | 00:53 | hooks to be able to tie it
back to specific customers.
| | 00:57 | From the Create tab I am going to go
and press the Table button, I am going to
| | 01:01 | add the field for Card Name, Card Type,
Card Number, all of those being short
| | 01:06 | text, and then we will add a field for
Expiration Date, which will be a date time field.
| | 01:10 | This first one, I'll double-click on
ID and change it to CreditCardID, I'll
| | 01:15 | press tab to go to the next field and press
the T key to select short text from the list.
| | 01:20 | This is our CardName field, I'll
press tab again and press T again for
| | 01:26 | another short text field.
| | 01:28 | This one of our CardType, tab again, and T
again, this is our CardNumber, tab again.
| | 01:39 | This time I am going to choose the
ExpirationDate, that's a Date & Time field, I
| | 01:43 | can go down with the arrow keys or just
press the D key to select the Date & Time
| | 01:48 | field and this is ExpirationDate.
| | 01:51 | We'll also need to create a way to tell us
what customer this CreditCard belongs to.
| | 01:56 | We could put a Name field, but what
would happen if we have two customers
| | 01:59 | with the same name?
| | 02:00 | How will we know, which of them this
Credit Card belongs to? This is why we have
| | 02:05 | a unique primary key in each table.
| | 02:07 | We can make use of them in other
tables so that we will know exactly which
| | 02:10 | customer each credit card belongs to.
| | 02:12 | This is called the foreign key in the
Credit Card's table, since it tells us who
| | 02:16 | each CreditCards belongs to.
| | 02:18 | Create an additional field named
CustomerID, I'll press the tab key here, and
| | 02:23 | this is going to be a Number field, so
press the N key and type in the CustomerID.
| | 02:29 | We can rearrange the position of
our columns by clicking on the Name.
| | 02:32 | I am going to press Enter to finish that,
and then click on that field to highlight it.
| | 02:38 | Now I can drag it to whatever position
I want, typically a foreign keys might
| | 02:42 | appear towards the beginning of
our table, but it's not required.
| | 02:45 | But I can click and drag to the
left to reposition this field.
| | 02:48 | I am going to place it right
after the CreditCardID field.
| | 02:52 | Also while we're here, we can realign
the width of our columns, simply
| | 02:56 | double-click on the edge between two fields
to adjust the width of the column on the left.
| | 03:01 | I'll double-click here, so that
CreditCardID fills out and double-click here for
| | 03:05 | CustomerNumber and
ExpirationDate to make those fields wider.
| | 03:10 | I am going to go ahead and save this
table now by pressing the Save icon or
| | 03:14 | pressing Ctrl+S on the
keyboard and we are going to call this
| | 03:17 | CustomerCreditCards.
| | 03:19 | Once you get that typed in, press OK,
and you'll a see it show up on the
| | 03:22 | Navigation pane on the left.
| | 03:24 | Now I'll start feeling in some
information to see how the foreign key field works.
| | 03:28 | Back in the Customers Table that we
filled in the last movie, we put in three
| | 03:32 | Customers, Evan, Micah, and Dante.
| | 03:34 | Evan is CustomerID number 1,
Micah is 2 and Dante is 3.
| | 03:39 | Let's create some Credit Cards
here in our CustomerCreditCards Table.
| | 03:42 | I'll click back on the tab to
switch back to the other Table.
| | 03:46 | Now let's say Evan and Micah, that's our
Customers 1 and 2, don't have any Credit
| | 03:50 | Cards that they want to save with us.
| | 03:52 | Dante, he's our Customer
number 3, and he has two CreditCards.
| | 03:55 | We will fill in the CreditCard Table like this.
| | 03:58 | The first CreditCard will have a
record ID on its own, this again, is an
| | 04:02 | AutoNumber field that
Access will take care for us.
| | 04:05 | The CustomerID, this is who
this CreditCard belongs to.
| | 04:08 | This CreditCard belongs to Dante;
| | 04:09 | he's our CustomerID number 3.
| | 04:12 | I'll press tab to go to CardName, this
is a business card, so I'll type the word
| | 04:17 | Business here, the CardType is a Visa,
and I just notice I have a typo here.
| | 04:23 | So I'll double-click on CardTyle and
rename it to CardType and press Enter, all
| | 04:28 | right, so that's a Visa card.
| | 04:30 | Let me go ahead and type in the
CardNumber here 4826-0526-8582-0623.
| | 04:40 | And I'll press tab to go to the next
field, the ExpirationDate, and I could
| | 04:43 | type in the ExpirationDate or
I can use the calendar picker.
| | 04:46 | Since this a few months out, I am just
going to go ahead and type it 10/31/2013
| | 04:52 | and press Enter to accept those changes.
| | 04:54 | I am going to double-click on
this line between CardNumber and
| | 04:57 | ExpirationDate one more time to
expand the width of that column to
| | 05:00 | accommodate the entire CreditCardNumber.
| | 05:02 | Now we are going to type in
another CreditCard for Dante.
| | 05:04 | CustomerID, well that's the same,
it's still a CustomerID number 3.
| | 05:09 | This time this is a PersonalDebit card,
it's still a Visa card and it's got a
| | 05:16 | number here and
ExpirationDate for this card is 3/31/14.
| | 05:23 | So notice that the structure is very
flexible and efficient in allowing us to
| | 05:26 | create one, many or no Records
that are related to each customer.
| | 05:30 | And the order that the cards are
entered doesn't matter, if Evan, he's our
| | 05:34 | CustomerID number 1, decides later to
put in a card, that's completely fine.
| | 05:38 | It can go anywhere in the Table as
long as it is tied to his CustomerID.
| | 05:42 | So let's put in one for Evan,
CustomerID for Evan is 1, this is his airline
| | 05:46 | rewards card, it's a MasterCard.
| | 05:51 | The number here is 5275-6787-1289-
1613 and the ExpirationDate is 2/28/15.
| | 06:02 | Adding foreign keys to your tables
is just like adding any other field.
| | 06:06 | The important point to keep in mind is
that the DataTypes must match, this means
| | 06:10 | that if you're using an AutoNumber
field as the primary key in one table, then
| | 06:14 | the foreign key in the related
table must be a number field.
| | 06:17 | As long as the data is the same, you
can use 1 as a reference to look up
| | 06:22 | information in the other.
| | Collapse this transcript |
| Importing tables| 00:00 | If you already have information stored
in a File such as an Excel workbook, you
| | 00:04 | don't need to retype it to get it into Access.
| | 00:06 | You can use the tools available on the
External Data tab in the imported link group.
| | 00:11 | You'll notice that we have lots of
different file types that we can bring into Access.
| | 00:15 | We can bring in Excel files, or Tables
from other Access Databases, we can bring
| | 00:20 | in Text files, which would
include comma-delimited.csv files.
| | 00:23 | We can choose XML and we have
additional options here under the More button.
| | 00:28 | Let's bring in an Excel file to
replace the Customers table that we began to
| | 00:32 | create in the prior movies in this chapter.
| | 00:34 | The file we are bringing in has
additional fields that we didn't create in the
| | 00:38 | original, such as fields for the Address.
| | 00:39 | Instead of creating those fields
manually and then importing the data, we can
| | 00:43 | create the entire structure
and import the data in one step.
| | 00:47 | I'll right-click on the Customers
Table and choose Delete from the pop-up
| | 00:50 | menu, Access will ask me to confirm
that I want to delete this table, and I
| | 00:55 | do, so, Ill press Yes.
| | 00:57 | Now we are going to bring in the Excel
file to replace it, back on the External
| | 01:01 | Data tab in the imported link section,
I am going to the press the Excel button
| | 01:05 | here, make sure you are pressing the
Excel button on the left half of your
| | 01:07 | screen, not the Excel button
that's in the Export group.
| | 01:11 | We want to bring data in so stay over
here in the left, press the Excel button
| | 01:16 | and the Get External Data,
Excel Spreadsheet Wizard starts.
| | 01:19 | First, we need to tell it
which file we want to bring in.
| | 01:23 | I am going to press this Browse
button and in the Exercise folder, in the
| | 01:28 | Chapter 02 folder, we'll
find the Customers Excel file.
| | 01:32 | I'll press Open, now we get to choose
what do we want to do with that file.
| | 01:37 | We have three options, we can either
import the Source data into new table in
| | 01:41 | the current database, we can Append the
copy of the records into a table if we
| | 01:45 | already have one existing, or we can Link
to the data source by creating a linked table.
| | 01:50 | If we create this as a linked table,
Access will be able to use the data that's
| | 01:54 | inside of the Excel file, but it won't
actually live inside of our database.
| | 01:58 | If any changes occur to the Excel file,
then those changes will be reflected
| | 02:02 | inside of Access, however, if that file
gets deleted or moved, then Access will
| | 02:08 | lose track of it, so it won't be able find it.
| | 02:10 | We want to bring the data
actually and manage it inside of Access.
| | 02:14 | So we are going to stick with the
first option, Import the Source Data into a
| | 02:18 | new table in the current database, go ahead and
say OK and the next step of the Wizard starts.
| | 02:22 | This top window is asking us which pieces
of that Excel workbook we want to bring in.
| | 02:27 | We can either bring in different
worksheets, or if we have named ranges, we
| | 02:31 | can bring those in.
| | 02:32 | I am going to stick to Show Worksheets
and choose the only worksheet that's in
| | 02:35 | that file, the Customers Worksheet.
| | 02:37 | It gives us a preview of what
that data looks like down below.
| | 02:40 | Go ahead and press Next.
| | 02:42 | Now we can tell Access that the first
row contains column headings, these are
| | 02:45 | the field names across the top in
the first row in the Excel file.
| | 02:49 | I'll turn the checkbox on and the
table updates to show that these are
| | 02:52 | headers and not data.
| | 02:54 | Go ahead and say Next.
| | 02:55 | Now we can go through and
choose the DataType for each field.
| | 02:59 | Access is pretty good about selecting
the correct DataType by the data that's
| | 03:02 | already present, but we can
click through to double-check.
| | 03:05 | This first one, the ID field, is a
double-digit data type, the next couple are
| | 03:10 | all short texts, and I can scroll
over to see additional data that's coming
| | 03:14 | in from the Excel file, the State, Short
Text and a ZIP Code that's also a short text.
| | 03:19 | We can also choose if we have fields
that we don't want to import, you can turn on the
| | 03:23 | checkbox do not import those and skip it.
| | 03:25 | We can also rename them if we would like.
| | 03:28 | I am going to accept the names that
came from the Excel file and I am not going
| | 03:32 | to skip anything, go ahead and say Next.
| | 03:34 | Now we get to choose how we
want to add our primary key.
| | 03:37 | We can let Access add a new column
that's the primary key or we can choose an
| | 03:42 | existing key if the ones are already there.
| | 03:44 | I'm going to choose my own primary key
and tell it to use the ID field, there.
| | 03:49 | Go ahead say Next again, and
finally, we get to name our table.
| | 03:53 | Access is bringing in the name in the
original Excel file, that's how it's
| | 03:57 | knowing that this is
customers. So that's great!
| | 03:59 | That works for us, go ahead say Finish
and Access brings that data into our Tables.
| | 04:03 | If we go ahead and close this, I do
not need with save the import steps, and
| | 04:08 | we've got our new table that showed
up here in the Navigation pane.
| | 04:11 | If I double-click on it,
we will see the results.
| | 04:14 | So there are all of our fields we've got,
and if I look at the bottom here, 200
| | 04:18 | total customers that we just imported.
| | 04:20 | We also imported the structure of this
table, including, what we had created
| | 04:23 | originally manually, the FirstName,
LastName, and Phone fields, but also we have
| | 04:27 | the Street, City, State,
and Zip code fields as well.
| | 04:31 | If you already have data set up in Excel,
the Import tool makes it really easy
| | 04:35 | to not only bring in that data, but also
quickly create the entire structure of the table.
| | 04:40 | Just choose the type of file you want
to bring in, and let Wizard walk you
| | 04:43 | through the options.
| | 04:44 | At the end of the process you'll have
your Table setup and ready to go, and if
| | 04:48 | you already have the Table structure
set up with some data inside of Access
| | 04:51 | already, you can use the Append
option in the Wizard to add data to an
| | 04:55 | existing table.
| | Collapse this transcript |
|
|
3. Setting Field PropertiesEstablishing relationships and maintaining referential integrity| 00:00 | Once our data tables have primary and
foreign keys established, we need to let
| | 00:04 | Access know which fields relate to which.
| | 00:07 | We can do this with the Relationships tool,
you can find it in a couple
| | 00:11 | of places, usually you are going to go
to the Database tools tab and find
| | 00:15 | Relationships here.
| | 00:16 | If you have a Table open, I am going to
go ahead and double-click on
| | 00:19 | this Customers table.
| | 00:20 | You'll also find under the Tables tools
Conceptual tab and Relationships here.
| | 00:26 | However, in order to modify or
create Relationships between Tables;
| | 00:30 | those Tables need to be closed.
| | 00:32 | So even though you can get to Relationships
through the Tables tab, it'll often
| | 00:36 | create a situation where you can't edit it
once you get there, because the
| | 00:39 | original table is still open.
| | 00:41 | So let's make sure our Tables are all
closed by clicking the Close button over
| | 00:45 | on the right side, and then going
to Database tools>Relationships.
| | 00:49 | The Relationship screen is essentially
a blank canvas where we can layout a map
| | 00:53 | of all of our tables and how
they relate to one another.
| | 00:56 | There is a new Contextual tab at the
top called Relationship tools Design, here.
| | 01:00 | We are going to press this Show Table
Window to bring up a listing of all the
| | 01:04 | tables in our Navigation pane.
| | 01:07 | Let's go ahead and create a relationship
between our Customers and their CreditCards.
| | 01:12 | You can click on each Table here and
press Add, or simply double-click to add
| | 01:16 | them to Relationships map.
| | 01:18 | I'll double-click on CustomerCreditCards
and double-click on Customers and then
| | 01:22 | have them back here to the Relationships.
| | 01:24 | Then I'll close the Show Table Window.
| | 01:27 | Now each of these boxes represents one
of the tables from our database; this one
| | 01:31 | is the CustomerCreditCards table; this
one is the Customers table. Within each
| | 01:36 | table, are all the fields
and those are listed here.
| | 01:39 | We can move these around by clicking
and dragging on their tops or from the
| | 01:43 | corner we can drag and make them resized.
| | 01:45 | I am going to resize the Customer,
so I can see all of the fields.
| | 01:49 | I will resize this one as well, and
then I will drag CustomerCreditCards and
| | 01:53 | move it to the right side of Customers.
| | 01:56 | To join these tables together, we are
simply going to find the primary key in
| | 02:00 | the Customers Table, which is this CustomerID
and you can see the primary key
| | 02:04 | icon here, and we are going to drag and
drop it on top of the foreign key from
| | 02:08 | the CustomerCreditCards table,
that's the CustomerID field here.
| | 02:13 | So I'll just click and drag, and when
I get over the other CustomerID, I'll drop it.
| | 02:18 | That will bring up the Edit Relationship screen,
where I can confirm the fields
| | 02:22 | that I dragged and dropped.
| | 02:23 | If I missed for some reason, I can just
click these dropdown menus and attach
| | 02:28 | it to a different field.
| | 02:29 | I am going to leave mine on CustomerID.
| | 02:32 | We have got some options here;
| | 02:33 | one very important option that you
can get to on this screen is the Enforce
| | 02:37 | Referential Integrity checkbox.
| | 02:39 | When this is checked, Access won't
allow you to create records in a table when
| | 02:44 | the foreign keys don't match
a record in the other table.
| | 02:47 | In our example here, if I turn on
Enforce Referential Integrity, Access won't
| | 02:51 | allow me to input a CreditCard that
isn't attached to a valid customer.
| | 02:56 | It will also prevent me from deleting a
customer while accidentally leaving their
| | 03:00 | CreditCard Info in the database.
| | 03:01 | In other words, it prevents orphan records.
| | 03:05 | Records that don't relate
to any parent info.
| | 03:07 | This is a really great control to have
on when appropriate, because it ensures
| | 03:11 | that your database remains reliable.
| | 03:13 | When Enforce Referential
Integrity is turned on, you'll notice two
| | 03:15 | additional options;
| | 03:16 | Cascade Updates and Cascade Delete, these
deal with situations when the data changes.
| | 03:22 | If you change a primary key, then
Cascade Updates will also make the same change
| | 03:27 | to the foreign keys in all
related tables. I'll turn that on.
| | 03:31 | With Cascade Delete, Access will
delete related records when the parent is
| | 03:35 | deleted. In our case, if I turn this
option on, then delete a Customer, Access
| | 03:40 | will automatically find their CreditCard records
and delete those as well.
| | 03:44 | Both of these options make
maintaining our database easy.
| | 03:47 | I'll turn them both on and then press the
Create button to establish the Relationship.
| | 03:52 | You'll notice now that these two
fields are joined by a line, on the left
| | 03:57 | side, the Customers side, we will see
the icon with a 1, on the right side
| | 04:01 | we'll see an infinity symbol.
| | 04:03 | This tells me that this is
a one-to-many relationship.
| | 04:05 | This is the most common kind
of relationship you'll find.
| | 04:09 | This says that every one Customer
can have many different CreditCards.
| | 04:14 | If a Customer wants to save hundreds or
thousands of different CreditCards with
| | 04:18 | us, no problem, we've setup
our Database to handle that.
| | 04:21 | Let's add an additional relationship
between our Employees Table and the Related
| | 04:24 | Phone numbers table.
| | 04:26 | Here, I can go into the Show Table
window to Open that again and click
| | 04:31 | EmployeePhone and Employees
and press Add to add those.
| | 04:35 | I'll Close the Show Table window and
I'll drag these fields around to line them
| | 04:40 | up, so Employees and EmployeePhones,
I can also enlarge them to make them
| | 04:45 | bigger, so I can see all the fields.
| | 04:47 | Now the EmployeeID matches the
EmployeeID field here in the phone number.
| | 04:52 | So I'll just drag, drop the joint line,
I will Enforce Referential Integrity to
| | 04:58 | make sure that we don't accidentally
remove a customer, but leave their phone
| | 05:01 | numbers behind and I'll press Create.
| | 05:03 | Again, we get the join line between the two.
| | 05:05 | Now I have got one more table that I
want to join up here, that's the States
| | 05:10 | Table, let me just open it up and
we'll take a look at what's in here.
| | 05:14 | The States table merely matches a
state with regions within our company.
| | 05:17 | That way if I attach this to our customers,
we can start grouping our Customers
| | 05:20 | together by region and not just a state.
| | 05:22 | It gives us more information about the States.
| | 05:25 | Let's close that down and we'll add
that to our Relationship map as well.
| | 05:29 | Now there is a shortcut here, I can
actually just take the States Table and drag
| | 05:33 | and drop it from my Navigation pane
and drop it on the Relationships map.
| | 05:38 | Now I just drag State from our
Customers table and drop it on the
| | 05:42 | StateAbbreviation field, which is
the primary key for the States Table.
| | 05:45 | We will create that join and we will move it
back over here, just so it lines up properly.
| | 05:51 | Before we end this movie, I want
to share one common tripping point.
| | 05:54 | The scrollbars on the bottom and right
side of your screen indicate that the
| | 06:00 | relationship map can be quite large.
| | 06:02 | But sometimes if you accidentally click
in one of these, everything disappears;
| | 06:06 | it scrolls right off your screen.
| | 06:08 | Oftentimes people will do this and
will think that everything is deleted, but
| | 06:11 | don't worry, everything is still there,
you just might need to scroll all the
| | 06:14 | way to the top and scroll
all the way to the left.
| | 06:17 | So that's how you establish
relationships between tables.
| | 06:20 | Anytime you create a new data table,
you want to revisit the Relationships map
| | 06:24 | to tell Access how the new table
integrates with all of the others.
| | Collapse this transcript |
| Editing table structure in Design view| 00:00 | All of the objects that we are going to
be creating in Access have multiple ways
| | 00:04 | to work with them. These are called
Views and you can switch between the
| | 00:08 | available views using the first button
here on the home tab, here, Views.
| | 00:13 | Let me open up the
Customers Table to activate it.
| | 00:17 | The Views button has two parts, the
upper half will toggle between two default
| | 00:21 | states. In the case of Tables that will
switch between Datasheet view like we
| | 00:26 | have now, and Design View here.
I'll press it again to toggle back.
| | 00:31 | The bottom half of the button will expand
to show additional views if available
| | 00:35 | for the object that you're working with.
| | 00:37 | Now let's go and take a look
at our Table in Design View.
| | 00:40 | I'll switch to Design View, and we
will see all the fields in our Table are
| | 00:44 | listed down in a column
instead of across the top.
| | 00:47 | We can also see their DataTypes, which
is the next column here, you'll see that
| | 00:51 | all of our fields in our Customer
Table are Short Text Data Types, except for
| | 00:54 | the ID field, which is an AutoNumber.
| | 00:56 | There is third column is where we
can put in a Description of the type of
| | 01:00 | data that goes here, this is a great place
to store any notes or reminders about each field.
| | 01:05 | It can be a very useful reference when
you come back to edit your tables later.
| | 01:09 | For instance, for our State I'm
going to enter the Description Two letter
| | 01:13 | state abbreviation.
| | 01:16 | We can also add or modify fields that
make up our Table here in Design View.
| | 01:20 | In some respects, it's actually easier
to create a Table in Design View than it
| | 01:24 | is in Datasheet View like we did earlier.
| | 01:26 | If I want to add an email field
before a phone number, I'll simply click on
| | 01:30 | the Phone number field,
| | 01:32 | go up here to the Ribbon and press Insert Rows.
| | 01:35 | That will insert a new blank row above the
Phone or I could type in the field EMail.
| | 01:42 | I'll press tab to select my DataType.
| | 01:45 | Again, I have got a dropdown list
just like in Datasheet View, and for this
| | 01:49 | I'll choose Short Text.
| | 01:50 | Finally, for the Description for
this field, I'll enter customers
| | 01:54 | primary contact email.
| | 01:56 | Now we can switch our View to Datasheet
View to see how that looks. Back on the
| | 02:00 | Design tab, I'll press this View button.
| | 02:02 | Access is going to tell us we
need to save the Table first.
| | 02:06 | So since we made structural changes,
I'll Save that changes there and now
| | 02:10 | it takes me back to Datasheet View
where we see our new EMail field here,
| | 02:14 | right before Phone.
| | 02:15 | Let's go a head and go back into Design View.
| | 02:17 | I'll go back, toggle that there
and now we are back in Design View.
| | 02:21 | The gray selection boxes to the left of
each field are handles, and we can use
| | 02:26 | those to rearrange the fields.
| | 02:28 | So if want to move our email to the end,
I'll simply click on that gray box and
| | 02:32 | then click and drag to rearrange
and I'll drag it to the bottom.
| | 02:35 | Notice that we can also quickly
identify the primary key field in this Table.
| | 02:39 | It has the yellow key icon that
we saw in the Relationships map.
| | 02:42 | This is good information to know and
is something that's not readily apparent
| | 02:46 | when looking at the table in Datasheet View.
| | 02:48 | If you don't have a primary key
established for your table, there is a button
| | 02:52 | here on the Ribbon to turn it on.
| | 02:54 | So you just click on the field and you
click on primary key to add that to that field.
| | 02:58 | We are going to take a look at the
Design View a little more in depth in the
| | 03:03 | next few movies, including the bottom
half of the screen, which deals with
| | 03:06 | additional properties for each field.
| | 03:07 | Now because changing our view is a very
common task throughout Access, there are
| | 03:11 | bunch of additional ways to do that.
| | 03:13 | From the Navigation pane, you can right-
click a Table, or any object, and choose
| | 03:17 | to open them straight into Design View.
| | 03:19 | The same applies to the objects
Name tab, if it's already open, you can
| | 03:22 | right-click and change your View here as well.
| | 03:25 | You can switch it to Datasheet View for example.
| | 03:28 | Again, Access it's going to ask me
the Save changes, so I will and now I'm
| | 03:32 | back in Datasheet View.
| | 03:34 | Also if the object is open, on the first
Contextual tab for that object, in this
| | 03:38 | case under the Table tools group, this
Fields tab, we will find a View button
| | 03:43 | here and there is also additional
little icons down on the bottom right corner
| | 03:47 | of your screen over here, to
change your Views there as well.
| | 03:51 | So we have lots of options to toggle our
Views back and forth between the working
| | 03:55 | Views and the Design Views.
| | Collapse this transcript |
| Controlling input with masks| 00:00 | Access databases give us lots of ways to
control the input of data into the tables.
| | 00:05 | This helps ensure that what we've
entered is typed correctly and often more
| | 00:08 | important, consistently.
| | 00:11 | We can make use of the Input Mask
Field property to help make sure that every
| | 00:15 | time we enter a phone number for
example, it gets formatted properly.
| | 00:18 | I am going to go ahead and open my
Customers table and I will open it in Design
| | 00:22 | View by right-clicking on it and
switching directly to Design View.
| | 00:26 | Now for my Phone number field here,
down in the Properties, we will see the
| | 00:30 | Input Mask property here.
| | 00:32 | When I click on it, we get a Build
button way over here on the right side.
| | 00:35 | These three little dots will indicate
that we are going to build a property
| | 00:39 | for this, and you will see this three dot
convention in a lot of places throughout Access.
| | 00:43 | Go ahead and press that button to
launch the Input Mask Wizard box.
| | 00:47 | Here we can choose from a
list of predefined Input Masks.
| | 00:50 | The Phone Number Input Mask is
what we are looking for here.
| | 00:53 | And down on the bottom we have a Try It box.
| | 00:56 | What I want to do is click in the very beginning
of that box and try typing in some numbers.
| | 01:01 | You will see that it formats
the phone number properly.
| | 01:03 | Go ahead and back off of that.
| | 01:05 | Let me try some different numbers.
| | 01:06 | It puts in all of the parentheses, the
spaces, and the hyphen in the right spot.
| | 01:11 | Go ahead and press the Next button
to accept the phone number property.
| | 01:14 | Now we can edit the Input Mask if we choose.
| | 01:16 | Access uses a little bit of code to
help tell it what's valid and what's not.
| | 01:20 | In this case the 9s indicate that it has
to be a number, but that it's optional.
| | 01:24 | The 0s indicate that it has to
be a number, but it's required.
| | 01:28 | We can also change the
placeholder character down here.
| | 01:31 | Currently it's an underscore (_).
| | 01:32 | If I use the dropdown list, I can
choose a different character, for instance,
| | 01:36 | this pound (#) sign and now in the Try
It box when I click down there, you will
| | 01:39 | see that it gets placeholders and
are shown up with a pound (#) symbol.
| | 01:43 | Let's switch it back to the underscore
(_) character and go ahead and press Next.
| | 01:48 | Now we get to choose how we want
to store the data in our table.
| | 01:51 | We can store the data without the symbols
in the mask, with just the numbers, or
| | 01:54 | we can store the symbols in the
mask with a parentheses and so on.
| | 01:58 | I am going to choose to store the symbols.
| | 02:00 | Go ahead and say Next and
that's all the wizard needs.
| | 02:03 | So we will say Finish.
| | 02:04 | Access puts the Input Mask down here
in our phone number field and we can go
| | 02:08 | ahead and switch back to
Datasheet View and test it out.
| | 02:11 | Now because this is a structural change
to the way the table functions, when I
| | 02:14 | switch my view, Access is going to
ask me if I want to save the table.
| | 02:17 | So go ahead and say Yes, and
now that change has been saved.
| | 02:21 | I will go ahead and go up to our
phone number field here and I'll just
| | 02:23 | highlight this first one and I'll delete it,
and we will try typing in those numbers again.
| | 02:28 | 383-835-9398.
| | 02:32 | You can see that it puts in all of the
punctuation properly, and I don't have to
| | 02:35 | take my hands off the number
keypad to type in the phone number now.
| | 02:38 | Let's go ahead and create one more.
| | 02:40 | I want to create an Input Mask that forces
all of my state abbreviations to be capitalized.
| | 02:45 | I don't want to have any
lowercase state abbreviations.
| | 02:47 | Let's go back into Design View to do that.
| | 02:49 | I will switch to Design View here and
for my State Field, I will go to the Input
| | 02:55 | Mask property again, and click the
build button over here on the right.
| | 02:59 | Now if I scroll through this list of
available Input Masks that are predefined,
| | 03:02 | you won't see anything about
state abbreviations in here.
| | 03:05 | So what we can do is say Edit List to add it.
| | 03:09 | The Edit List field shows up and it's set
up just like Records in any other table.
| | 03:14 | So you can see the Input Mask Wizard
properties are set up like a table.
| | 03:18 | I can scroll through the various
predefined input masks or I can go to the very
| | 03:21 | end to the blank record, which is
number 5 here and put in my own.
| | 03:25 | I am going to put in a Description
here, State Abbreviations.
| | 03:29 | The Input Mask here is going to be the
greater than symbol (>) which indicates
| | 03:33 | that everything I am going to type in
is going to be forced to be uppercase and
| | 03:37 | then I am going to put in two Ls.
| | 03:40 | The Ls indicate that we are
only going accept a letter.
| | 03:42 | We won't be able to put in any numbers here.
| | 03:45 | The next field is the Placeholder.
| | 03:46 | This is what shows up we haven't typed anything.
| | 03:49 | I am going to put in an
underscore (_) character.
| | 03:51 | Then down below Sample Data, this is the
example of what the output will look like.
| | 03:55 | So we can see it when we
choose it from the list.
| | 03:58 | I will type CA for California as our example.
| | 04:00 | Go ahead and say Close to this, and you will
see it now at the bottom of our list, there.
| | 04:05 | Go ahead and select it. We will say Next.
| | 04:08 | We can see the abbreviation mask
here, our placeholder character there.
| | 04:12 | We can go ahead and try it out here.
| | 04:14 | Now you have to click at the very
beginning in order for this to work.
| | 04:16 | So I will go to the beginning and we
will try typing in two letters, and you can
| | 04:19 | see that they're forced to be uppercase.
| | 04:22 | If I press Shift and type in
those letters, that works as well.
| | 04:26 | But if I back off and try typing in
any numbers, it won't let me do that.
| | 04:30 | So go ahead and say Next.
| | 04:32 | We are going to, well, there are
actually no symbols in this mask, so it doesn't
| | 04:35 | really matter how we choose here.
| | 04:38 | But go ahead and say Next anyway, and Finish.
| | 04:41 | It inputs the mask down here at the
bottom and now if I go back to my Datasheet
| | 04:45 | View, again, we'll have to save the table.
| | 04:48 | Now I will go ahead and try
typing in my states again.
| | 04:51 | It doesn't matter how I try typing them
in, I can't get a lowercase letter here.
| | 04:55 | Using Input Masks where appropriate is
a great way to make sure that the data
| | 04:58 | that gets entered into your database is
consistently formatted in the same way
| | 05:01 | no matter who sits down at the keyboard.
| | Collapse this transcript |
| Setting the default value| 00:00 | When you have a field that will
commonly contain the same information
| | 00:03 | record after record;
| | 00:05 | you can specify a DefaultValue to
appear when entering the record.
| | 00:09 | The default value will allow you to
simply skip over that field while typing and
| | 00:13 | it will automatically put in
the most common information.
| | 00:15 | Of course, if you'd like to change it, you can.
| | 00:18 | The DefaultValue is simply a suggestion.
| | 00:20 | Let's add one to our Customers Table.
| | 00:22 | I'm going to right-click on my Customers
Table and switch directly to Design View.
| | 00:26 | For my state, let's say I want to add a
Default Value of the State of California
| | 00:31 | where most of my Customers live.
| | 00:32 | I'll go down to the Default Value
property here and click once.
| | 00:36 | When I do that this Build button
opens over here on the right.
| | 00:39 | I'll click the Build button and now
we'll start the Expression Builder.
| | 00:43 | Here's what I'm going to type in
what I want to my Default Value to be.
| | 00:47 | I'm going to type ="CA" this is telling
Access that I want to Default Value to
| | 00:55 | literally be the letters C and A for California.
| | 00:58 | We'll go ahead and say OK.
| | 01:00 | And that Default Value
will get populated down here.
| | 01:03 | Now let's try it out, I'll Save the
changes to my structure of the table here
| | 01:07 | and switch into Datasheet View.
| | 01:10 | Now I'll go down and add a new record by
clicking the New Record button down here.
| | 01:14 | You'll notice when I get down there, the
state is already pre-populated with California.
| | 01:19 | I can type in what I want for my values,
and I'll just tab through these here.
| | 01:23 | And when I get to the City I can type
in what city I want, and when I press tab
| | 01:28 | again, if it's California, great!
| | 01:30 | Just press tab one more time to skip
over that and keep going with the zip code.
| | 01:33 | I'm going to press Shift+Tab
to back up a little bit.
| | 01:36 | Now let's say I want to enter in a different
city and state, and now when I get
| | 01:39 | to the state, if I want to do Texas for
example, I just type in TX like I would
| | 01:44 | normally, and then tab to
go into the zipcode field.
| | 01:46 | So however I want to do it, if I want
to accept California, I can, if I need to
| | 01:50 | change it, I can do that as well.
| | 01:53 | Now while we are here in Datasheet View,
I should point out that we can also
| | 01:56 | set the Default Value by selecting a field,
then going to the Table tools, Field tab here.
| | 02:02 | I'll select the Default Value
option here, and that also starts the
| | 02:05 | Expression Builder.
| | 02:07 | Adding Default Values to your Table Design
is an easy way to speed up data entry, by
| | 02:11 | automatically suggesting the most
common values for a particular field.
| | Collapse this transcript |
| Establishing validation rules| 00:00 | Validation rules allow you to control
what data gets saved in the database.
| | 00:04 | If you try and enter a value that isn't
allowed by the Validation Rule, Access
| | 00:08 | will display a warning and
allow you to fix the problem.
| | 00:11 | Let's put some Validation Rules
into effect in our Employees table.
| | 00:14 | First, I am going to double-click
on the Employees table to open it up.
| | 00:17 | Now in our Employees table we
have a HireDate column here.
| | 00:21 | I want to make sure that the dates that are
entered are either today's date or earlier.
| | 00:25 | I don't want to be able to enter
in a date that's in the future.
| | 00:27 | Let's scroll over to the right.
| | 00:29 | We also have a JobRating field here.
| | 00:31 | Our job ratings fall in the range of 1 to 5.
| | 00:34 | I don't want somebody to be able
to put in a 0 for example or a 10.
| | 00:37 | So I am going to create Validation Rules to
control the data entry on these two fields.
| | 00:41 | We will do that by switching into Design View.
| | 00:44 | Now for the HireDate field, I will click there.
| | 00:47 | We've got these properties
down here for Validation Rule.
| | 00:50 | When I click in the Validation Rule property,
the Build button shows up over on the right.
| | 00:53 | I will click that to launch
the Expression Builder.
| | 00:57 | Here we are going to type in
the code for our Validation Rule.
| | 01:00 | We want the dates that are
earlier or equal to, today.
| | 01:03 | That will launch the Expression Builder.
| | 01:04 | Here we are going to
type in our Validation Rule.
| | 01:07 | I will type <= and then the code to
get today's date, which in Access is just
| | 01:12 | the Date function, and an open
parenthesis and then a close parenthesis.
| | 01:16 | Go ahead and say OK and Access adds
that rule down here in our property.
| | 01:21 | The Validation Text line is a string
of text that will show up if somebody
| | 01:25 | enters an invalid record.
| | 01:26 | This can be really a friendly message here.
| | 01:28 | So I am going to type in Must be
today's date or earlier, okay, so that's our
| | 01:32 | first Validation Rule.
| | 01:33 | Now we are going to add
the one for JobRating here.
| | 01:36 | I will click on Validation Rule and
once again return to the Expression Builder
| | 01:40 | by clicking the Build button.
| | 01:41 | The Validation Rule for our JobRating
is that we only want values that are
| | 01:45 | greater than or equal to 1, and the
less than or equal to 5 (>=1 and <=5).
| | 01:51 | I will go ahead and say OK to
accept that Validation Rule.
| | 01:54 | This time I am going to
leave the validation text blank.
| | 01:57 | If you leave it blank, you just get a generic
error message when somebody enters
| | 02:00 | in an invalid record.
| | 02:01 | So let me go ahead and see
what those changes look like.
| | 02:04 | We'll save the changes to our table
by clicking the Save icon on the Quick
| | 02:07 | Access toolbar, and then we will
accept this messages here that says Data
| | 02:10 | integrity rules have been changed;
| | 02:11 | existing data may not be valid
for the new rules. That's fine.
| | 02:15 | Go ahead and say Yes and we
will switch into Datasheet View.
| | 02:19 | Now I am going to scroll over here and
let's try and edit this HireDate here.
| | 02:23 | Currently it says 6 January, 1998.
| | 02:25 | Let's enter in a date in the future, 1/1/2213.
| | 02:30 | If I try and press Tab to move
off of that field, I get the error.
| | 02:33 | Must be today's date or earlier. Okay.
| | 02:37 | I can always press the Esc key to
return to the last valid entry value.
| | 02:41 | Now let's press tab to go over to my JobRating.
| | 02:44 | If I try and type in a 0 and press Enter,
I get a generic error message that
| | 02:48 | says one or more values are
prohibited by the validation rule.
| | 02:51 | Save that and if I change it to 10,
I get the same error message.
| | 02:56 | Go ahead and say OK, and I will change
it into something that's in the right
| | 03:00 | range, like 5, and press
Enter and it accepts that value.
| | 03:03 | So Validation Rules can act as gatekeepers
to make sure that you can trust the
| | 03:07 | data that is saved in your tables.
| | 03:09 | I would recommend that anytime you use a
Validation Rule, you should always also
| | 03:13 | put in a friendly reminder in
the Validation Text property.
| | 03:16 | It provides additional instruction to
the person that is trying to type in the
| | 03:19 | values into your table.
| | Collapse this transcript |
| Creating lookup fields| 00:00 | A Lookup field allows you to select
a value from a list when populating a
| | 00:04 | table with information.
| | 00:05 | Like Validation Rules and Default Values,
this is another tool that you can use
| | 00:10 | to ensure that the information in
your Access database is valid and
| | 00:13 | consistently entered.
| | 00:14 | I am going to go ahead and
open up our Employees table here.
| | 00:17 | I've got a field called Status, and
when I look through the table, I notice
| | 00:21 | that I have four distinct categories
of employees; Full-Time, Half-Time,
| | 00:24 | Contracts, and Hourly.
| | 00:26 | I want to turn this into a lookup list to
help speed up the entry for new employees.
| | 00:30 | I will switch to Design View to do this.
| | 00:33 | I am going to go to my Status field here
and take a look at a Lookup field here.
| | 00:38 | Currently, it's set to Text Box.
| | 00:41 | This allows me to type in a value.
| | 00:42 | Access provides a wizard that will walk
us through creating a Lookup list for a
| | 00:46 | brand-new field, but unfortunately, it
doesn't provide the wizard to convert an
| | 00:50 | existing field into a Lookup list field.
| | 00:52 | So for this example, I'm going to
first create a duplicate status field using
| | 00:56 | the wizard so that we can see what the
options are, and then we will use that
| | 01:00 | knowledge to convert the
existing status field into a lookup.
| | 01:03 | This way I won't lose the existing status
information for the 700 plus employees
| | 01:08 | already in the database.
| | 01:09 | Now I am going go up to the
ribbon in the tools group here.
| | 01:12 | There is a button called Modify Lookups,
but when I hover over it, the tool tip
| | 01:16 | says Insert Lookup Column.
| | 01:18 | This button might be named
differently on your computer.
| | 01:20 | I will click this button here
and the Lookup wizard starts.
| | 01:24 | We have two options.
| | 01:25 | We can either choose to get the Lookup
field values from a table or query or we
| | 01:29 | can type in the values I want.
| | 01:31 | I will go ahead and type in the values.
| | 01:33 | Go ahead and say Next and now Access
brings up a little table here where we can
| | 01:37 | type in the values for our fields.
| | 01:39 | Here we are going to type in
Full-Time, Half-Time, Contract, and Hourly.
| | 01:47 | We will go ahead and say Next.
| | 01:48 | Now we can name our new field.
| | 01:49 | I am going to call this, Status2.
| | 01:51 | Notice that we have a checkbox to Limit to List.
| | 01:54 | If we leave this off, we can choose
from the list or type in whatever we want.
| | 01:58 | I will turn Limit to List on, to
prevent other values from getting entered.
| | 02:02 | We can also choose to store multiple
values, but that really doesn't make sense
| | 02:06 | in this case, because an employee
can't be two statuses at the same time.
| | 02:10 | I will go ahead and say
Finish to complete the fields.
| | 02:13 | We will see we have a new Status2
field here entered right above Status and
| | 02:17 | its Lookup properties have been changed to
Combo Box, Value List, and here are our values.
| | 02:23 | Let's go ahead and see how this works.
| | 02:25 | I'll save the changes to the structure of
my table and I will switch to Datasheet View.
| | 02:30 | Now I have got the Status2 field and
when I click there, it becomes a Combo Box
| | 02:34 | where I can select a value to populate the list.
| | 02:36 | I will choose the Full-Time here.
| | 02:38 | Now let's take that knowledge back
into Design View and we will convert our
| | 02:41 | existing Status field into a Lookup list.
| | 02:44 | I will go back to Design View.
| | 02:46 | We will take a look at the existing
properties for existing status field.
| | 02:49 | I will click there.
| | 02:50 | I will see the Lookup property is set
to Text Box, but when I change that here
| | 02:55 | to a Combo Box, I get all
of the additional properties.
| | 02:58 | So now we just need to copy over
what we learned from the other field.
| | 03:02 | Our Row Source Type, instead of Table
Query, we are going to choose Value List
| | 03:07 | and our Row Source, this is where
we type in values we want to appear.
| | 03:10 | I will type in Full-Time;
(semicolon to separate the fields)
| | 03:16 | Half-Time; Contract; and Hourly.
| | 03:23 | I have some additional properties down below.
| | 03:26 | Here is the Limit to List property
we saw in the wizard.
| | 03:29 | I am going to change that to Yes.
| | 03:32 | I can allow multiple values.
| | 03:34 | I will leave that to No.
| | 03:36 | I can also Allow Value List Edits.
| | 03:39 | If somebody tries to type in a new value
and it's not in the list, Access might
| | 03:43 | allow them to add it to the list.
| | 03:45 | Here I don't want to allow
them to add new values.
| | 03:47 | So I will leave that to No.
| | 03:48 | I will switch back into Datasheet View.
| | 03:50 | We will save the changes to the
structure and we'll take a look at the
| | 03:53 | original status column.
| | 03:55 | We will see all of our values are
still there, but when I click on it,
| | 03:58 | it becomes a Combo List.
| | 04:00 | This will greatly speed up entry
when we try and enter in a new employee.
| | 04:04 | Now the only thing left is to get rid
of this other duplicate Status2 field.
| | 04:07 | One more time, back in Design View,
I will select the Status2 field and I will
| | 04:13 | press Delete Rows from the ribbon.
| | 04:14 | It will ask me if I want to
permanently delete them, and I will say Yes.
| | 04:19 | Now my table is complete.
| | 04:20 | I can close it and save the changes.
| | 04:23 | So in addition to providing control
over what gets entered, Lookup list can
| | 04:26 | dramatically speed up data entry as well.
| | Collapse this transcript |
| Setting additional field properties| 00:00 | There are a few other field properties
available in Table Design View that
| | 00:04 | are worth exploring.
| | 00:05 | Let's take a look at them
on the Employees table.
| | 00:07 | I will open that up in the Design View, and the
first one I want to look at is the EmployeeID.
| | 00:13 | Right now it's set to an AutoNumber
DataType, and has the Field Size of Long
| | 00:17 | Integer and the New Values are set to Increment.
| | 00:20 | Long integer fields store whole numbers
only, no decimals, and include a range
| | 00:24 | from about -2 billion to +2 billion.
| | 00:28 | So we have plenty of space
to grow with this field size.
| | 00:30 | For a Short Text field like our
FirstName, we can store up to 255 characters.
| | 00:36 | If you know you only need a certain
number of characters, you can make your
| | 00:39 | database more efficient,
if you specify a lower number.
| | 00:42 | For instance, the State field in our
Customers table only needs to store two
| | 00:46 | letter state abbreviations.
| | 00:47 | I can change the field size there to 2.
| | 00:50 | If I leave it set at the default 255,
Access blocks out enough space to store
| | 00:55 | 253 characters that I will never need.
| | 00:59 | It does this for every single record.
| | 01:01 | Setting it to 2 frees up that space
making the database smaller and faster.
| | 01:05 | The Caption properties will allow you to
specify a header name that is different
| | 01:09 | from the official field name.
| | 01:11 | This can be useful when setting up
forms as the labels that get auto created
| | 01:15 | will use this caption,
instead of the field name text.
| | 01:18 | However, setting a caption here often
just creates confusion down the line,
| | 01:22 | since the true field name is essentially
masked from view, which can make making
| | 01:26 | references more difficult to set up.
| | 01:29 | The Required property here allows
us to force a field to be entered.
| | 01:33 | Otherwise, the record won't be saved.
| | 01:35 | The primary key field is always required,
since it's the one field that keeps
| | 01:39 | the database working properly.
| | 01:41 | For this table I am going to set the
FirstName and LastName fields to also be
| | 01:45 | Required, because that's the minimal
amount of information that I want before
| | 01:48 | adding a new employee to the database.
| | 01:50 | So I will set LastName to Required as well.
| | 01:52 | We can also establish
additional Indexes on the table here.
| | 01:55 | Again, the primary key field is
already indexed, but you can create
| | 01:59 | additional indexes if needed.
| | 02:01 | Having additional indexes on the right
fields can help speed up searches and queries.
| | 02:05 | Think about it like this.
| | 02:07 | If I give you a phonebook and a
person's name, you can quickly look up the
| | 02:10 | person's phone number, since the
phonebook is indexed by last name.
| | 02:14 | However, if I give you a phone number
and the same phonebook, imagine trying to
| | 02:19 | find who that number belong to.
| | 02:20 | You would have to search through
every single line of the book to locate
| | 02:24 | the correct person.
| | 02:25 | However, if we had a reverse
directory, essentially a phonebook that is
| | 02:29 | sorted by the number instead of name,
you'd be able to locate the phone
| | 02:32 | number fairly quickly.
| | 02:34 | Adding additional indexes is similar.
| | 02:36 | However, the drawback is that every
time you add a new record, all of the
| | 02:40 | indexes have to be rebuilt.
| | 02:41 | There is a definite tradeoff and you
will have to experiment with your data
| | 02:45 | tables and queries to identify the
optimal number of indexes for your database.
| | 02:49 | I am going to add an index here to
the LastName field, since we will be
| | 02:52 | searching by last name fairly often.
| | 02:54 | I'll change this Indexed to
No, to Yes, (Duplicates OK).
| | 02:59 | The Date/Time DataType has a format
property that's currently set to show a one
| | 03:03 | digit day, a three letter abbreviation
for the month, and a two digit year.
| | 03:08 | We can make this a little more
standardized by using this dropdown list and
| | 03:11 | choosing from the available options.
| | 03:13 | I am going to change it to show Short Date.
| | 03:15 | I will start out with the
slashes instead of those dashes.
| | 03:18 | Now as you might have noticed as
we have been clicking through these
| | 03:21 | properties, over here on the right,
we get a little bit of descriptive text
| | 03:25 | that tells us what that property is,
and if we want additional help, we can
| | 03:29 | press F1 to go to the website.
| | 03:31 | So while I am here in the Format
property, I will press the F1 key on
| | 03:35 | my keyboard to load Microsoft Help
from the website, where we can get
| | 03:37 | some additional help.
| | 03:39 | You should continue exploring the
properties for various DataTypes.
| | 03:42 | Different DataTypes will have
additional properties associated with them,
| | 03:45 | and many are self explanatory, but I
am going to admit that some of them,
| | 03:49 | such as the IME Sentence mode may be
so obscure that you will never have a
| | 03:52 | reason to adjust it.
| | 03:54 | However, if you ever have a question
or like some additional resources on
| | 03:57 | these properties, simply click in the box
and press F1 to quickly get to the Help sheet.
| | Collapse this transcript |
|
|
4. Organizing RecordsFormatting columns| 00:00 | Most of the text formatting that you will
want to do will occur in form or report objects.
| | 00:05 | After all, they are specifically designed
for screen interface and printed output.
| | 00:10 | However, there are some very basic
formatting tools available when viewing your
| | 00:13 | tables directly in Datasheet View.
| | 00:15 | I am going to go ahead and open up the
Customers table by double-clicking on it.
| | 00:19 | Now I will select the FirstName
Evan here and try changing it to Bold.
| | 00:22 | I will press bold in the Text
Formatting group on the Home tab.
| | 00:26 | You will quickly see what happens.
| | 00:28 | Even though we had just selected one
cell, the change to a bold font applied
| | 00:32 | to the entire table.
| | 00:33 | In fact, this happens with
most of these formatting options.
| | 00:35 | I can turn Bold off, and try turning on
Underline for instance, and you will see
| | 00:40 | that everything becomes underlined.
| | 00:41 | I will turn that off and try changing the
font color here and everything turns red.
| | 00:46 | Let's go ahead and use a dropdown
list and change it back to Automatic.
| | 00:50 | Here and there you might have a
reason to do this, but most of the text
| | 00:53 | formatting that you will want to do will be
done inside the forms or reports later on.
| | 00:58 | One formatting option that I've come
across that maybe more useful is to color
| | 01:01 | code tables using the alternate
background shading here.
| | 01:04 | I can use the dropdown list and select a color.
| | 01:07 | For instance, I can color code by
Customers tables blue and then I can color
| | 01:12 | code my Employees table green.
| | 01:14 | That way I have a visual cue when
I am working inside each of them.
| | 01:17 | One place where we can apply a different
formatting in a table is when the field
| | 01:21 | is a rich text enabled, long text data type.
| | 01:24 | Let's add one to our Customers table.
| | 01:27 | On the far right I will click here to
add a new column and I'll choose Rich Text.
| | 01:31 | I will give it the name Comment and press Enter.
| | 01:35 | Now I will make that field wider
by clicking on the bar between them
| | 01:38 | and dragging it wider.
| | 01:40 | Now I will scroll back, so I
can see some of the other fields.
| | 01:44 | I am going to enter in a
Comment for my first customer.
| | 01:47 | He is the winner of our Spring
promotion and has a $50 credit.
| | 01:51 | Now I can select individual words,
for instance, I will select the second
| | 01:54 | sentence and change it to Bold with
a green font, and you can see that it
| | 01:58 | changes independently of the
rest of the words in the line.
| | 02:01 | I mentioned before that this is a
rich text enabled, long text data type,
| | 02:05 | whichis quite a mouthful.
| | 02:06 | You can see this more clearly in Design View.
| | 02:08 | I will switch to Design View here and
we'll take a look at that Comment field.
| | 02:12 | You can see its data type is Long Text.
| | 02:15 | Long Text is different from Short Text
in that a Long Text field allows you
| | 02:18 | to store over 65,000 characters, whereas, a
Short Text has a limitation of 255 characters.
| | 02:25 | If I look down at the Text Format property at
the bottom, we will see its set to Rich Text.
| | 02:30 | The other option is Plain Text.
| | 02:32 | Plain Text won't allow you to set
other formatting options with this line.
| | 02:37 | So those are the settings that
you'll need to know in order to style text
| | 02:40 | inside of your tables.
| | 02:41 | Keep in mind that Rich Text is only
available in a Long Text DataType.
| | 02:45 | As we move through the course, we will
see other areas where text formatting
| | 02:48 | will play a larger role in the
styling of your Access database.
| | Collapse this transcript |
| Sorting table data| 00:00 | A common task with any table of
data is to sort contents to bring
| | 00:04 | relevant records to the top.
| | 00:06 | On the Home tab of the Ribbon, we have a
Sort & Filter group here that holds all
| | 00:10 | the tools to do just that.
| | 00:12 | I will open up the Employees
table to take a look at those options.
| | 00:16 | Right now our records are in the order
that they are put into the database, with
| | 00:19 | the first record, Employee 1 at the
top, and Employee 741 at the bottom.
| | 00:25 | I can see that by clicking on the Last Record
button down on the navigator, 741 there.
| | 00:31 | I will click the first record
to return back to the top.
| | 00:33 | I can sort these records based off
of any field that I choose however.
| | 00:37 | To put them alphabetically by LastName,
I will click on any cell in the LastName
| | 00:40 | field, or I can select the entire column
by clicking on the header row.
| | 00:44 | Then press the Ascending button to sort A to Z
or the Descending button to sort Z to A.
| | 00:51 | Notice the tiny arrow icon that
appears on the header row here.
| | 00:55 | That's your indication that the table is
currently sorted based off of that field.
| | 00:59 | I can then click Remove Sort here to
reset the table to its original state.
| | 01:05 | These options are also available in
the menu when you click on a header.
| | 01:09 | If I click on the dropdown here,
we'll see Sort A to Z or Sort Z to A.
| | 01:13 | Sorting on Department will allow us to
group everybody based off of their department.
| | 01:19 | I will choose Sort A to Z.
| | 01:21 | Now all of my Account Managers are
together, and if I scroll down, we'll find
| | 01:25 | everybody in the Creative Department,
and the Environmental Department.
| | 01:29 | I will press the Remove Sort button
again to return the table to the
| | 01:32 | default state once again.
| | 01:33 | This brings up a couple of important
conceptual points that I'd like to
| | 01:36 | mention about records.
| | 01:38 | Remember that records, that is, the
horizontal rows in your data tables,
| | 01:42 | represent a single entity, thing, or event.
| | 01:45 | Each cell in a row goes
with the others in that row.
| | 01:48 | It wouldn't make any sense to mix them up.
| | 01:50 | So when I sort these fields, wherever Tate
goes for example, Zachary will go with it.
| | 01:57 | They move up and down in the sorting
order together, moving as an unbreakable unit.
| | 02:01 | In Access, there is no way to break
that functionality, and accidentally sort
| | 02:05 | a column one-way and lose the relationship to
its adjacent information in the other columns.
| | 02:10 | The other important concept here is the
idea of a record's position in a table.
| | 02:14 | Right now, Zachary Tate is
record number 1 out of 741.
| | 02:19 | I can see that by glancing down to the current
record indicator at the bottom of the screen.
| | 02:24 | Now it's record number 1 because it
is in the first position in the sorting
| | 02:27 | scheme, not because of its employee ID number 1.
| | 02:31 | A record's position in a table
is a very transitive thing.
| | 02:34 | Anytime we talk about a record's number,
we really mean, in the sorting order
| | 02:39 | this is record number 1.
| | 02:41 | That's one of the main reasons
why we use a primary key.
| | 02:44 | When I say Employee ID 1, I will always
be referring to Zachary Tate here,
| | 02:49 | regardless of how the table is sorted.
| | 02:51 | When I say record number 1, it can refer
to any number of records depending
| | 02:55 | on how they're sorted.
| | 02:57 | It's an important distinction that
will come into play more as we move on to
| | 03:01 | explore the other objects that
make up an Access database.
| | 03:03 | Sorting our records provides an easy way
to bring some alternate organization
| | 03:07 | to the data tables.
| | 03:08 | You can use it to group like values together,
such as our building or
| | 03:11 | departments, or provide alphabetized directories,
based off of names of people or products.
| | Collapse this transcript |
| Filtering table data| 00:00 | The filtering options on a table allow
you to limit the number of records on
| | 00:04 | screen to only those of interest.
| | 00:06 | Just like the Sorting, this allows you to
quickly get to the information that you need.
| | 00:10 | I'll open the Employees table again by
double-clicking on it and this time we
| | 00:14 | will use the Filtering options
in the Sort and Filter group here.
| | 00:18 | We want to identify just the employees
that work in the IT department.
| | 00:21 | The easiest way is to find a record
that matches what we want to filter by
| | 00:25 | and select that field.
| | 00:26 | I'll go ahead and choose somebody in
the IT department here record number 19,
| | 00:32 | Garrison North, then on the ribbon, we
have a group of tools to filter based off
| | 00:36 | of the selected cell.
| | 00:38 | We can choose Equals "IT", Does not Equal "IT",
Contains "IT" or Does not contain "IT".
| | 00:44 | I'll choose Equals "IT" to filter my records.
| | 00:48 | If I look down the bottom, here I can
quickly see that I've got 44 records in
| | 00:52 | this view of the data and here's another
a visual button to indicate that we are
| | 00:56 | currently looking at a
filtered list of our data.
| | 00:59 | In fact this is a toggle I can click on
a Filtered button, to toggle between a
| | 01:03 | Filtered and return to the
Unfiltered state of my data.
| | 01:06 | We can continue to filter down even further.
| | 01:08 | For instance, I can choose somebody in
the West building such as Chris Bauer
| | 01:12 | here and then filter again based off of
this to get a quick look at just the IT
| | 01:18 | people in the West building.
| | 01:19 | Again looking down the bottom of my
screen I can see we have total of six
| | 01:23 | people in this group.
| | 01:24 | If you want to filter based off of
multiple criteria for each field we can
| | 01:28 | use the menu attached to the header of
each column to select from the available data.
| | 01:32 | Simply place the check box next to
the values that you want displayed.
| | 01:35 | So in addition to the IT department,
let's scroll down and choose Product
| | 01:40 | Development as well, I'll go ahead and say Ok.
| | 01:43 | Now looking at the bottom, I can see I
have 10 employees that are in the West
| | 01:48 | building that are either in Product
Development or the IT Departments.
| | 01:52 | For a quick exploration of your data, a
filter can bring up just what you need in a hurry.
| | 01:56 | While you can toggle between Filtered
and Unfiltered states of your data, there
| | 02:00 | is no way to save multiple filters
and move back and forth between those.
| | 02:04 | At first this might seem like it will
be a very useful feature in an obvious
| | 02:08 | oversight but rest assured, you'll see why
this is when we get to exploring query objects.
| | 02:13 | While you can filter your data here
inside of a table directly, queries really
| | 02:17 | do take that functionality to the next level.
| | Collapse this transcript |
| Searching and replacing values| 00:00 | No text editing environment would be
complete without an easy way to search
| | 00:04 | through all of the text and make replacements.
| | 00:07 | Access is no exception and we can use
the same Find and Replace tools that you
| | 00:11 | may be familiar with from other Office programs.
| | 00:14 | On the Employees table, we can locate
specific records quickly and easily using
| | 00:18 | the Search box at the bottom of the screen.
| | 00:22 | For instance I'll type Green here
to quickly find Kim Green's record.
| | 00:26 | But what if I want to find additional records?
| | 00:28 | Well, you can just keep pressing the
Enter key to cycle through all the matches.
| | 00:32 | We will find people at work in the
Green Building Department and if I keep
| | 00:37 | pressing Enter I'll find Alexander Greene
spelled with an E at the end of his name.
| | 00:42 | An alternative option is to go up on to
the Ribbon and click on the Find button
| | 00:46 | up here with the big binoculars icon,
that'll bring up the Find and Replace
| | 00:50 | tabs, on the Find tab I can
type in what I'd like to find.
| | 00:54 | I have additional options of where I
want to look either in the Current field or
| | 00:58 | the Current document or how I want to match.
| | 01:02 | Any part of the field, the Whole
field, or the Start of the field.
| | 01:05 | If I change to Whole field and press Find
Next, it only find's Kim Green's record.
| | 01:11 | If I press Find Next again it won't
find any other records, it won't locate the
| | 01:16 | Green Building Department and it won't
find Alexander Greene spelled with an E,
| | 01:21 | go ahead and say Ok.
| | 01:22 | The Replace tab of the Find and
Replace dialog will go through our entire
| | 01:26 | table and replace text.
| | 01:28 | That makes it very easy to
change a lot of data at once.
| | 01:31 | I've noticed that in the Status field
over here on the right, that my Half-Time
| | 01:35 | employees are spelled with a hyphen.
| | 01:37 | I want to standardize this to just a space.
| | 01:40 | I'll use the Replace tab of the Find
and Replace dialog box to do just that.
| | 01:44 | I'll type Half -Time with a hyphen
in the Find What field and then in the
| | 01:48 | Replace With, I'll type Half Time with a
space, I am going to search through the
| | 01:52 | entire document and we are
going to match the entire field.
| | 01:55 | I'll press Find Next and Access will
find the first occurrence, I can then press
| | 02:00 | Replace to replace it and move to the next one.
| | 02:03 | I can continue pressing Replace to cycle
through, replacing those texts or I can
| | 02:08 | press Replace All to process the entire column.
| | 02:10 | Access warns me that I won't be able to
undo this replace operation, once I do
| | 02:14 | this change, it's made permanent in the table.
| | 02:16 | I'll go ahead and press Yes to process
the column and I'll see that all of my
| | 02:20 | statuses are now updated without
a hyphen in the half-time fields.
| | 02:24 | The Find and Replace tools make it a
snap to locate specific records as well as
| | 02:28 | edit out common inconsistencies in the data.
| | Collapse this transcript |
|
|
5. Using QueriesUnderstanding queries| 00:00 | Queries are temporary looks at your
data that are constructed from the records
| | 00:04 | and fields stored in your data tables.
| | 00:06 | A Query is literally a question that
you ask of the data, and the result is
| | 00:10 | returned as a temporary
datasheet called a record set.
| | 00:13 | Record sets merely display data they
don't store it permanently, this means that
| | 00:17 | when your tables update the
query record sets update.
| | 00:21 | There is no need to update the
data in two or more locations.
| | 00:24 | Further, the record set functions
just like any of your other tables when
| | 00:28 | feeding records to a form or
report or even, in fact, to another query.
| | 00:32 | On the surface, and as far as the other
database objects are concerned, they
| | 00:36 | are tables, but as we'll see they're
simply pretending to be tables.
| | 00:41 | The problem is, is that the tables we've
created in Access are very efficient in
| | 00:45 | storing data, but it also seems a
little counterintuitive, when it comes time
| | 00:49 | to actually finding information
spread between lots of tables.
| | 00:53 | If for instance, we needed to quickly
find Robert Acosta's emergency contact
| | 00:56 | phone number, we first need to look
up his employee ID, then take that
| | 01:01 | information to the phone table and
then find his employee ID there and
| | 01:04 | finally get the number.
| | 01:06 | If you have hundreds or thousands of
phone numbers to look up for a human
| | 01:09 | sifting through these tables
that could be a lot of work.
| | 01:12 | Luckily we have Query
objects to do all that for us.
| | 01:15 | Queries bridge related tables back
together in whatever configuration we might need.
| | 01:20 | To create a Query we simply need to
write out some basic instructions on how
| | 01:24 | to assemble the data.
| | 01:26 | Imagine that you take your data
tables and you smash them all apart.
| | 01:29 | Every field is now its own building block.
| | 01:32 | When you create a Query, you essentially
cherry pick which fields you want to
| | 01:35 | pick up, which fields you want to ignore
and in what order to snap them to
| | 01:39 | back together again.
| | 01:40 | The only space that queries take up in
the database is just enough to store a
| | 01:44 | few lines of simple instructions
on how to reassemble your data.
| | 01:48 | Regardless of how many
records those tables contain.
| | 01:50 | And that's just the most basic
thing that they can do for you.
| | 01:54 | Needless to say Queries are very powerful
component of your Access database, and
| | 01:57 | the wizards and design tools make it
easy for you to harness that power.
| | Collapse this transcript |
| Creating queries with the Simple Query Wizard| 00:01 | As with many of the objects in Access,
the easiest way to get started with
| | 00:05 | queries is to have the wizard
walk us through some of the steps.
| | 00:08 | Before we get started,
let's have a goal in mind.
| | 00:11 | Let's first take a look at
the existing data tables.
| | 00:14 | Our EmployeePhone list is setup as a
table that is related to the Employees table.
| | 00:17 | If we take a look, we can see an
EmployeeID field here that is the foreign key
| | 00:22 | that matches the primary
key in the Employees table.
| | 00:26 | This phone table tells me that the
first three records here all belong to the
| | 00:30 | same employee, number 635.
| | 00:33 | But it doesn't tell me who that employee is.
| | 00:35 | Instead of looking this information
up manually, we can use a query to
| | 00:38 | reassemble it for us.
| | 00:40 | Let's go ahead and close
this EmployeesPhone table.
| | 00:42 | I am going to go to the Create Tab here and
we'll create a new query using the Query Wizard.
| | 00:47 | I will start the wizard.
| | 00:50 | We're going to do a simple
query, so go ahead and say OK.
| | 00:54 | And the next screen that opens up asks us
which tables are we going to use as the
| | 00:58 | basis for our query.
| | 00:59 | We had already selected the EmployeesPhone
table over here in the navigation
| | 01:03 | pane, so that's the first
table that it suggests.
| | 01:06 | I am going to actually use the Employees
table first, because I want my names to
| | 01:09 | appear at the beginning.
| | 01:10 | I will choose FirstName, and I am going
to use this arrow button to move it over
| | 01:16 | from the Available Field side to Selected Fields.
| | 01:18 | I will do the same thing with LastName.
| | 01:20 | Make sure it's highlighted, and then press
this arrow to move it over to select it.
| | 01:24 | Now if I wanted to move all of the fields
at once, I could use this double-arrow.
| | 01:28 | If I wanted to undo that and move
everything back, I can use this double-arrow
| | 01:32 | to move them all back from selected to available.
| | 01:35 | And if I just want to move one field back,
I would use this button here to move
| | 01:39 | it back to the other side.
| | 01:41 | So I am going to make sure that
I have FirstName and LastName.
| | 01:44 | We also want to pull in the related
records from the phone table.
| | 01:47 | So I will go back up to the dropdown
and choose the EmployeePhone table.
| | 01:51 | There, I want to know the phone number,
and the type of number that it is.
| | 01:55 | Go ahead and say Next.
| | 01:57 | Access asks us if we want
to show details or a summary.
| | 02:00 | We want to show every field of every record,
so go ahead and say Next, and we
| | 02:04 | can go ahead, and give it a name here.
| | 02:07 | Employees Query doesn't really describe
what this is, so I am going to call this
| | 02:10 | EmployeePhoneNumbers.
| | 02:11 | Finally, we have the option to choose
whether we want to open the query, or go
| | 02:15 | into Design View to continue editing.
| | 02:16 | I am going to choose to 'Open the query
to view the information', and press Finish.
| | 02:22 | Access returns the query results, and
we can see now that the first three phone
| | 02:26 | numbers all belong to the
same person, Zachary Tate.
| | 02:29 | Now additional summary options are available
when numeric data is included in the query.
| | 02:33 | Let's get a query that summarizes our
data instead of displaying every record.
| | 02:36 | I am going to close the results of
our EmployeePhoneNumbers query.
| | 02:40 | If I needed to get it back, you will
notice that it's here in the Navigation pane.
| | 02:44 | This time I am going to create a query that
takes a look at our products, and our orders.
| | 02:48 | I've got two new tables here.
The Products table, if I open that,
| | 02:51 | you will see that it includes all of the
products that NoObstacles carries.
| | 02:55 | I will go ahead and close that table.
| | 02:57 | The Orders table has a list of ID numbers
that match customer IDs to the product IDs.
| | 03:04 | It has a listing of the dates that the
product was ordered, and the quantity
| | 03:07 | that the products was ordered.
Go ahead and close the Orders table here.
| | 03:10 | We're going to create a query
that summarizes that information.
| | 03:14 | We'll go back up to the Query Wizard,
a simple query, go ahead and say OK.
| | 03:21 | This time I am going to choose the Products Table,
and from that, I want to know
| | 03:26 | which products were ordered.
| | 03:28 | From the Orders table, I want to
get the quantity that has been ordered
| | 03:33 | from every customer.
| | 03:35 | We'll add that to the selected
fields, go ahead and say Next.
| | 03:39 | This time, instead of showing every
field of every record, I am going to
| | 03:42 | get some summaries.
| | 03:43 | We'll click the Summary
and then Summary Options.
| | 03:45 | I will choose to add up all of the
quantities of every product, so that I can
| | 03:50 | get a listing of the total
ordered for each product.
| | 03:53 | Go ahead and say OK, and Next.
| | 03:57 | Finally, we can give this a name.
| | 03:58 | I am going to call it TotalProductsOrdered.
| | 04:01 | Once again, I am going to choose to
open the query to view the information,
| | 04:04 | and we'll press Finish.
| | 04:06 | Now I've got a listing of all the
products that we sell and the total number of
| | 04:10 | products that have been
ordered throughout the company.
| | 04:13 | The Query Wizard can help you quickly get
up to speed constructing some basic queries.
| | 04:18 | For even more control and options, we
need to take a look at the query design
| | 04:21 | environment and we'll do that in the next movie.
| | Collapse this transcript |
| Building queries in Design view| 00:00 | The Query Designer is a very powerful
tool to have at your disposal, and it's
| | 00:04 | layout makes it easy to find the answers
of some very complex questions.
| | 00:08 | The easiest way to begin exploring the
query design environment is to take a
| | 00:12 | look at an existing query,
and see how it was put together.
| | 00:15 | We'll use the EmployeePhone list query
here that we created in the last movie.
| | 00:19 | I am going to right-click on it
and open it in Design View.
| | 00:22 | Now the query design environment
is split into two sections.
| | 00:27 | The upper-half of the window is
essentially a mini relationships map.
| | 00:30 | It shows us the tables that are
involved in building our query.
| | 00:33 | We've got the Employees table,
and the EmployeesPhone table.
| | 00:37 | We can also see how they're related based
off of the EmployeeID field here and here.
| | 00:41 | The bottom-half of the window describes
all of the columns that go into
| | 00:45 | creating our query.
| | 00:46 | In this particular query, we have the
FirstName column, the LastName column, both
| | 00:50 | of those coming from the Employees table,
we also have the Number column and the
| | 00:54 | Type column, coming from
the EmployeesPhone table.
| | 00:58 | We can rearrange this window a little bit
if I want to give more room to the top-half.
| | 01:02 | I will click on this bar here, and drag down.
| | 01:04 | If I want to give more room to the
bottom-half, I will click and drag up.
| | 01:08 | So this is essentially what
the Query Wizard built for us.
| | 01:10 | Let's construct it on our own
using a blank Query Design environment.
| | 01:14 | I'll close this query out.
| | 01:17 | I am not going to save any changes to it,
and I will go to the Create Tab and
| | 01:21 | select Query Design.
| | 01:24 | Access starts up the Query Design environment,
and it gives us this Show Table
| | 01:28 | window just like when we
built our relationships.
| | 01:30 | From here, I can choose which tables
I want to be involved in the query.
| | 01:33 | I will choose EmployeePhone and press Add,
and then choose Employees, and press Add.
| | 01:39 | Then I will close the Show Table window.
| | 01:42 | We can rearrange these tables however we like.
| | 01:44 | I am going to take EmployeePhone and
move it to the right, and I'm going to open
| | 01:48 | up the Employees table just a little bit.
| | 01:50 | I will move this window up to
give me more room at the bottom.
| | 01:54 | Now I just need to take the fields from our
tables, and move them down into the query grid.
| | 01:57 | We're going to build our query using the
FirstName, and LastName from our employees.
| | 02:03 | Now I can click and drag FirstName
and drop it into the first column.
| | 02:07 | A shortcut way to do this
is to just double-click.
| | 02:09 | I will double-click on LastName
to add it to the next column.
| | 02:13 | Our third column is going to be the
Number from the EmployeePhone table, I will
| | 02:17 | double-click on that, and
then we're going to add Type.
| | 02:20 | I will double-click again.
| | 02:22 | At this point, this query is exactly
the same as what the Wizard built for us.
| | 02:26 | We can check it out by running its
datasheet here to see the results. And there we go.
| | 02:31 | Let's go ahead and switch
back in the Design View.
| | 02:35 | We can do a couple of additional things
here in the Design View that the Query
| | 02:38 | Wizard didn't allow us to do.
| | 02:39 | For instance, under the Sort row here,
we can choose to sort our results based
| | 02:45 | off of, for instance, LastName.
| | 02:46 | I will click and choose to sort ascending.
| | 02:49 | I can also choose to show
or hide particular fields.
| | 02:52 | By default, it's going to show
all of the fields that you've added.
| | 02:55 | But if for some reason you want to turn
one off, for instance you want to add it
| | 03:00 | just to sort but you don't need to
necessarily see it, you can uncheck the Show
| | 03:03 | checkbox and that field will not
display in the query's record set.
| | 03:06 | I will go ahead and turn this back on.
| | 03:08 | We can also rearrange the
columns once they've been put down.
| | 03:11 | In order to select a column, there
is this gray bar at the very top.
| | 03:15 | When you hover your mouse over, you
get a downward pointing black arrow.
| | 03:18 | Just click there to select it, and once
it's selected, you can click and drag to
| | 03:22 | move it to a different position.
| | 03:24 | I will click and drag LastName and move
it to the beginning of my query results.
| | 03:28 | Each half of the screen also have
their own set of independent scrollbars.
| | 03:32 | Often times these scrollbars can
accidentally get clicked, and it will look like
| | 03:36 | your fields became blank again.
| | 03:38 | So make sure that your scrollbars are
always to the left, and to the left and
| | 03:41 | top in the upper-half of the window.
| | 03:43 | Finally, let me point out a really
important distinction between these two
| | 03:46 | buttons in the upper left-hand
corner of your screen;
| | 03:48 | the View button and the Run button.
| | 03:51 | For most of the queries that we're going to
create, they're considered Select Queries.
| | 03:54 | They simply pull records
out of your data tables.
| | 03:57 | And for those, it doesn't really matter
which button you press.
| | 04:00 | Viewing the datasheet and running
that query are exactly the same;
| | 04:04 | they both display the query's record set.
| | 04:07 | I will go ahead and switch back to Design View.
| | 04:09 | The only time these two buttons differ
is when we're looking at Append Queries,
| | 04:13 | the Make Table Query, the
Update Query or the Delete Query.
| | 04:16 | These are all of the action queries,
and you can see the same exclamation
| | 04:20 | mark in their icon.
| | 04:21 | When you run these query types, which
we'll talk about in later movies, those
| | 04:25 | actually make changes to your database.
| | 04:27 | So when those queries are active, the View
button and the Run button are very different.
| | 04:32 | But like I said, for the select queries
that we create, either one of these
| | 04:36 | buttons will both display
the records data sheet.
| | 04:39 | We're going to continue working in the
Query Design View throughout this chapter.
| | 04:43 | There are a lot of options to explore
and some really cool ways that we
| | 04:46 | can organize our data.
| | 04:47 | But they will all start with the same basic model.
| | 04:50 | We will start with the tables to pull the
information from up top, and then add
| | 04:54 | the individual fields that will be combined
into the final datasheet down below.
| | Collapse this transcript |
| Establishing constraints with criteria| 00:00 | In addition to gathering and displaying
records from data tables, we can add
| | 00:04 | filtering constraints to the query design
grid to only display the exact records
| | 00:08 | we're interested in seeing.
| | 00:10 | Let's see how this works by exploring
the data we've collected for
| | 00:12 | NoObstacles customers.
| | 00:14 | I want to start a new query in Design View
by going to the Create Tab and then
| | 00:18 | pressing Query Design.
| | 00:20 | In the Show Table window, I am
going to choose a couple of tables.
| | 00:24 | I'll choose Customers and I am going to
double-click on the States table to add that.
| | 00:28 | Go ahead and close the Show Table window,
and now we need to populate the grid
| | 00:31 | down below with fields from our tables.
| | 00:34 | Let's go ahead and open up the Customers
table a little bit so we can see all of
| | 00:36 | the fields, and I will
just move this over a little.
| | 00:40 | From the Customers table, we're
going to choose the FirstName, I will
| | 00:43 | double-click on that, double-click on
the LastName to choose that, our phone
| | 00:47 | number, the state that they live in.
| | 00:49 | And then from the related States table,
I'm also going to get the RegionName.
| | 00:53 | I will double-click on
that to add that to our grid.
| | 00:56 | Now let's go ahead and
take a look at where we're at.
| | 00:58 | I am going to run the datasheet by
clicking on the View button here, and
| | 01:02 | we'll see the results.
| | 01:03 | We've got each customer, their first
and last name, their phone number, the
| | 01:07 | state they're in, and then the
region that state belongs to.
| | 01:10 | Let's go ahead and switch back to Design View.
| | 01:12 | Now we can add filtering criteria using
this Criteria row down in the design grid.
| | 01:17 | For instance, if I'm only interested in
the people that live in New York State,
| | 01:21 | I can go to this Criteria row
and type in NY and press Enter.
| | 01:26 | Access wraps that in quotation marks
which is the exact syntax that it needs.
| | 01:30 | I will go ahead and run my datasheet
again here, and we'll see our query record
| | 01:35 | set is filtered to just the customers
that live in the state of New York.
| | 01:38 | Let's go ahead and switch back to Design View.
| | 01:41 | I can change this up by
typing in CA for California.
| | 01:44 | This time I will type the quotes myself; 'ca'.
| | 01:49 | Go ahead and view those results, and
you can see that I have a lot of customers
| | 01:53 | from California, I've got 18 by
looking down here at the bottom.
| | 01:57 | Go ahead and go back to Design View.
| | 01:59 | I am going to delete this criteria here for
State, and let's go over to the Region column.
| | 02:04 | Let's add-in a region for Midwest.
| | 02:08 | I will press Enter and go
ahead and view that record set.
| | 02:12 | We've got a total of 49 customers
that live in the Midwest region.
| | 02:16 | Now what happens if we type in a query
criteria that doesn't exist in our database?
| | 02:19 | I will go into Design View.
| | 02:21 | And instead of Midwest, I am going to
type Europe, which is a region that I know
| | 02:27 | does not exist in the database.
| | 02:29 | Let's view that record set.
| | 02:30 | Now you might be surprised
that we didn't get any errors.
| | 02:33 | But if you think about what
Access is telling us here, this actually
| | 02:36 | makes perfect sense.
| | 02:37 | We asked our database to show us all of the
customers that were in the European region.
| | 02:42 | Well, here they all are.
| | 02:43 | We don't actually have any,
so Access shows zero matches.
| | 02:47 | There is nothing wrong with the
question at all, and this is the correct answer
| | 02:50 | to the question that we asked.
| | 02:51 | Let's go back into Design View
and change Region back to West.
| | 02:56 | I will go ahead and run the record set one
more time, and then we'll save these results.
| | 03:01 | I will click the Save button to save
our query, and I am going to call this
| | 03:05 | Customers-WestRegion and press OK.
| | 03:09 | Now let's add one more change.
| | 03:11 | I am going to go back in the Design View,
I am going to change this Region from
| | 03:15 | West to Midwest, run it just to make
sure I get results, and I'll save that
| | 03:21 | again, but I am going to
save it with a new name.
| | 03:23 | For that, I will go to the File Tab,
go to Save As, and then Save Object As
| | 03:28 | to create a duplicate.
| | 03:29 | I will press the Save As button here,
and now we'll give it a different name.
| | 03:35 | Instead of Copy of Customers in
the WestRegion, we'll call this
| | 03:38 | Customers-MidwestRegion.
| | 03:41 | Go ahead and say OK and that takes
us back to our standard interface.
| | 03:45 | And now you can see we have two queries here;
| | 03:48 | Customers-MidwestRegion,
and Customers-WestRegion.
| | 03:48 | I will go ahead and close the query down.
| | 03:51 | And anytime we want to view our people
from the Western region, we just run
| | 03:55 | this, anytime we want to see our customers
from the Midwest region, we'll run this one.
| | 03:59 | The Criteria row of a Query Design View allows
you to quickly and easily filter your data.
| | 04:04 | Unlike adding filters directly to your
data tables, you can save your query
| | 04:08 | in any number of configurations and have lots
of different filters applied to the same data.
| | Collapse this transcript |
| Specifying criteria with wildcards| 00:00 | Adding wildcard characters to your
query criteria is perfect for those times
| | 00:04 | when you want to filter your data based on
a common pattern rather than an exact match.
| | 00:09 | Let's create a new customers
query to see how wildcards work.
| | 00:12 | From the Create Tab, I'll press Query Design,
and I'll add a Customers table to
| | 00:17 | the query grid, and close the Show Table window.
| | 00:20 | From here, I'll add the fields
FirstName, LastName, Phone, and I'll scroll
| | 00:26 | down, and get State.
| | 00:29 | Now let's assume that we want
to break this list up by LastName.
| | 00:32 | We have seen how we can simply add
the name we want to the Criteria field.
| | 00:36 | For instance, underneath
LastName, I'll type 'harvey'.
| | 00:40 | If I run this query, you will see
that we have three customers with the
| | 00:44 | last name of Harvey.
| | 00:45 | Let's go back into Design View.
| | 00:48 | But what if you wanted all of the customers
that have the last name that starts with H?
| | 00:52 | The most common wildcard character
that you will probably use is the asterisk
| | 00:55 | (*) character or Shift+8 on your keyboard.
| | 00:58 | The asterisk character is a placeholder for
any character and any number of characters.
| | 01:02 | We can use this to specify criteria, it
displays all of the customers that begin
| | 01:06 | with h by changing our
criteria here from harvey to h*.
| | 01:11 | When I press Enter, Access updates the
query to read it Like 'h*' with the h*
| | 01:17 | in quotation marks.
| | 01:18 | This is simply saying that, instead of
exactly matching this text, we want the
| | 01:22 | records that are like this pattern.
| | 01:24 | It's probably best to get used to
this syntax and just type it in the way
| | 01:27 | that is required rather than relying on Access
to understand your intent and fix it for you.
| | 01:32 | Sometimes, Access doesn't get it
quite right when it tries to auto-correct.
| | 01:36 | Now when we run this query, we'll see
our 22 customers that have last names
| | 01:41 | that start with the letter H.
| | 01:43 | Let's go ahead and switch back into
Design View, and we'll mix it up a little more.
| | 01:47 | Another wildcard character at our
disposal is the question mark (?).
| | 01:50 | The question mark character
stands for any single letter or number.
| | 01:54 | Change the criteria to 'h???' and press Enter.
| | 02:00 | Again, Access updates our syntax and
now when we run this query, we'll get
| | 02:05 | only our customers whose last name
starts with h, and has a total of four
| | 02:09 | different characters.
| | 02:11 | I'll run it, and we'll see that we only
have two customers that meet this criteria.
| | 02:14 | Let's go ahead and switch
back into Design View again.
| | 02:17 | We can also specify a
character list as a wildcard.
| | 02:21 | Simply enclose the list of characters
to match inside of square brackets.
| | 02:25 | Here is an example where Access won't
autocorrect our syntax for you, and add the Like.
| | 02:29 | Go ahead and type in here
instead of Like 'h???', type-in [abc]*.
| | 02:39 | Here our intent is to gather all of the
last names that either begin with A, a
| | 02:44 | B, or a C, and then any characters after it.
| | 02:46 | But you will see when you press Return,
you get an error message that Access
| | 02:50 | doesn't understand what you're trying to do.
| | 02:52 | Go ahead and say OK, and at this point,
we'll add in the Like operator manually.
| | 02:58 | I'll press the Esc key to back out
of it, and now I'll just type Like,
| | 03:03 | space, quotation mark.
| | 03:05 | Now I will type-in the square bracket
abc, closing bracket, asterisk, and a
| | 03:10 | closing quotation mark.
| | 03:12 | Now when I press Enter, there aren't
any error messages, and we can run our
| | 03:16 | data sheet to see the results.
| | 03:18 | We'll see all of our customers whose
last names either begin with an A, a B, or
| | 03:22 | a C, and looking at the bottom, I see
that I have a total of 47 customers that
| | 03:27 | meet these criteria.
| | 03:28 | Adding wildcards to your query criteria
can make filtering very effective when
| | 03:33 | there is a pattern to the
records you'd like returned.
| | 03:35 | Simply use the asterisk to specify any
number of characters, the question mark
| | 03:39 | when you only want one character, or a
character list in square-brackets when you
| | 03:43 | want to match specific characters.
| | 03:45 | And remember to include the Like operator
to keep Access from misunderstanding your intent.
| | Collapse this transcript |
| Leveraging multiple criteria with AND and OR statements| 00:00 | Adding multiple query criteria to filter
your records can be accomplished in a
| | 00:04 | couple of different ways.
| | 00:06 | Let's create a query that explores
our employees' data, and uses
| | 00:09 | multiple filtering criteria.
| | 00:10 | I am going to create a new query in Design
View by going to the Create Tab>Query Design.
| | 00:15 | From there, we'll add our Employees table.
| | 00:19 | And from the Employees table, we'll choose
FirstName, LastName, Department, and Status.
| | 00:28 | If we add multiple criteria on the
same line, Access treats them as a
| | 00:32 | logical AND statement.
| | 00:34 | Let's try adding manufacturing to the
criteria row under Department, and we'll
| | 00:38 | add Full Time in the Criteria row under Status.
| | 00:42 | Notice that when I typed in Full Time,
Access started thinking that I was typing
| | 00:46 | in the function called Time.
| | 00:48 | That's not really what I want.
| | 00:49 | So I need to make sure that I include
the quotation marks on my own.
| | 00:52 | I'll press Backspace a few times.
| | 00:54 | And this time, I'll type in
the quotation marks, 'full time'.
| | 00:59 | Now I can press Enter, and that works out fine.
| | 01:01 | Let's view our datasheet to see the results.
| | 01:03 | I'll click on the Datasheet button here.
| | 01:06 | We'll see we have a total of 80 employees
that are both in the Manufacturing
| | 01:10 | department, and that are a Full Time status.
| | 01:13 | Let's go back into Design View.
| | 01:16 | You will notice that the
line below Criteria says 'or'.
| | 01:20 | In fact, you can think of every
line below as also 'or' lines.
| | 01:23 | When you place multiple criteria on
these lines, Access returns the logical
| | 01:27 | combination of the two criteria.
| | 01:29 | So if we move Full Time from this
line up here, I'll just delete over that,
| | 01:35 | down, and move it to the 'or' line
here, remember to type-in the quotation
| | 01:38 | marks, 'full time', quotation mark.
| | 01:40 | If I run this query,
we'll see a different result.
| | 01:43 | Now I get a total of 464 employees
that are either in the Manufacturing
| | 01:48 | department, or that are
Full Time, or possibly both.
| | 01:53 | Let's switch back and explore a little further.
| | 01:55 | Go back into Design View.
| | 01:57 | What happens if we want to
display two criteria on the same field?
| | 02:00 | Well, we can use the 'or'
line in this case as well.
| | 02:03 | Let's remove the Full Time criteria here,
and underneath Manufacturing, I am
| | 02:08 | going to type quality assurance.
| | 02:11 | Now I'll run the query, and we'll
see just the employees that are in the
| | 02:14 | Manufacturing or Quality
Assurance departments. All right.
| | 02:18 | Go back in the Design View.
| | 02:20 | There is a shortcut to writing that
out on a single line using something
| | 02:23 | called a Logical Operator.
| | 02:25 | But it includes a common tripping point.
| | 02:27 | Often, you'll think to yourself
something along the lines of, I want to see all
| | 02:31 | the employees in the Manufacturing
and Quality Assurance departments.
| | 02:35 | If you go to the criteria line and type
that out, I'll delete Quality Assurance
| | 02:38 | here, go back up above where it says
Manufacturing, and after that, I'll type
| | 02:43 | out 'and', in quotation mark,
'quality assurance' and press Enter.
| | 02:48 | If it's too long, you can enlarge the
field by clicking and dragging here.
| | 02:52 | So now it reads
'manufacturing' And 'quality assurance'.
| | 02:56 | Let's run that data sheet.
| | 02:58 | This time, I don't get any results.
So why is that?
| | 03:00 | Well, if we think it through, you will
realize that you've actually asked for
| | 03:04 | all of the employees that are in
both departments at the same time.
| | 03:07 | Obviously, that doesn't apply to anyone,
so Access returns the zero results.
| | 03:11 | Let's go back into Design View.
| | 03:13 | If we change 'and' here to the word
'or', so now it reads 'manufacturing' or
| | 03:19 | 'quality assurance', I'll click
to the end and press Enter.
| | 03:23 | Now I'll run the datasheet, and we'll
get the same results that we had when
| | 03:27 | they were on multiple lines.
| | 03:28 | So changing 'and' to 'or' is
the easy fix to a common mistake.
| | 03:32 | Now we get the results that we expected.
| | 03:34 | There is one place where using the
logical operator 'and' makes sense.
| | 03:38 | Let's go back into Design View the
last time, and I am going to add in our
| | 03:42 | HireDate field from the
Employees table to the query.
| | 03:45 | Let's say that we are interested in only
the Manufacturing or Quality Assurance
| | 03:49 | people that were hired in 2012.
| | 03:51 | We can go into the Criteria row
here and type it out.
| | 03:55 | I will say between and the first day
of 2012, 1/1/2012, and the 12/31/2012.
| | 04:06 | I'll make that field a little larger,
so we can see the whole thing.
| | 04:08 | And now, we can specify a range by using 'and'
here because that makes sense in this context.
| | 04:14 | Go ahead and run it.
| | 04:14 | And we'll see just the 14 employees
that are either in Manufacturing or the
| | 04:19 | Quality Assurance departments
that were hired in the year 2012.
| | 04:23 | We did that by making use of multiple
criteria on the same line in the Access
| | 04:27 | Query Design View and mixing in a
couple of 'and' and 'or' logical operators.
| | Collapse this transcript |
| Filtering with mathematical comparisons| 00:00 | When it comes to filtering data, there
is one additional class of operators that
| | 00:04 | is specifically used with numerical data.
| | 00:06 | They're called Comparison Operators
and they are useful for all those
| | 00:10 | situations where you want to specify records
returned that are above or below a
| | 00:13 | specific numerical value.
| | 00:15 | Let's put those to use in our Employees query.
| | 00:17 | I will go to Create>Query Design.
| | 00:21 | I'll add the Employees table to our query,
and close the Show Table window.
| | 00:25 | And from the Employees table, we'll add
the FirstName, LastName, and I'll scroll
| | 00:30 | down to get salary and job rating.
| | 00:34 | You're probably already familiar with
the Comparison Operators even if you don't
| | 00:37 | know them by that name.
| | 00:38 | I am going to right-click on the Criteria field
underneath Job Rating, and
| | 00:43 | select this box called Zoom.
| | 00:45 | This window here will just
give me a larger area to type.
| | 00:48 | We can change the font size;
| | 00:50 | it might make it a little easier to see.
| | 00:51 | I'll change it up to 16 and say OK.
| | 00:55 | The Comparison Operators are the less
than symbol, the greater than symbol, the
| | 01:00 | less than or equal to symbol, the
greater than or equal to symbol, equals, and
| | 01:07 | is not equal to, there.
| | 01:08 | Now I can go ahead and delete these out.
| | 01:12 | Now if we wanted to see just our
highest rated employees, we've seen already
| | 01:16 | how we could type out something like this;
| | 01:17 | "4" or "5" as our criteria.
| | 01:22 | Well, we can do the same
thing using Comparison Operator.
| | 01:25 | I'll delete this again,
and I'll simply say '>=4'.
| | 01:28 | We will say OK to add that
down into my criteria, down here.
| | 01:36 | This is easy when we have discrete steps
like our Job Ratings which only have
| | 01:40 | five values to choose from, but what
about salaries which can be any value?
| | 01:44 | Well, we can do the same thing using our
salary criteria, something like >70,000
| | 01:49 | to get everyone that is at a pay level
and above, without having to specify
| | 01:52 | every dollar value possible and a
really long chain of 'or' statements.
| | 01:55 | Let's go ahead and run
this query to see the results.
| | 02:00 | You can see that we've got a total
of 75 employees that are making above
| | 02:03 | $70,000, and also have a job rating at 4 or 5.
| | 02:08 | When filtering based off of numerical values,
think about specifying values with
| | 02:12 | the comparison operators;
| | 02:13 | the less than, greater than, and equal to signs
make specifying entire ranges of data quick and easy.
| | Collapse this transcript |
| Creating flexible queries with parameter requests| 00:00 | Sometimes you'll want to create a query
framework that answers many variations
| | 00:04 | on the same question.
| | 00:06 | Instead of hard-coding your queries to
use the exact same criteria every time
| | 00:10 | they run, you can instead ask the
user when it's run for the criteria.
| | 00:14 | This is called a parameter request, and
they're another very useful tool to have
| | 00:18 | when building your databases.
| | 00:19 | We'll start by creating a simple
query that looks at our customers.
| | 00:22 | Under the Create Tab>Query Design,
and add the Customers table.
| | 00:27 | I'll close the Show Table window, and
from that table, we'll choose FirstName,
| | 00:31 | LastName, and I'll scroll down, and grab State.
| | 00:36 | Now we've seen how to specify
criteria that looks at a single state.
| | 00:39 | For instance, down under the State in
this Criteria row, I'll type WA to select
| | 00:43 | all the customers that live in Washington State.
| | 00:47 | If I were to save his query, every
time it's run, it will always return
| | 00:51 | Washington customers.
| | 00:53 | Now imagine creating 49
other variations of this query;
| | 00:56 | one for every state in the country.
| | 00:58 | That will be kind of tedious, and not to
mention how quickly, that would clutter
| | 01:01 | up your navigation pane.
| | 01:03 | We can instead change this
into a parameter request
| | 01:05 | that asks for the state we're
interested in when it's run.
| | 01:08 | So I am going to delete where I put in
Washington here, and instead I am going
| | 01:12 | to type in a request, and
I'll put this in square-brackets;
| | 01:15 | so an open square-bracket,
Which state would you like?
| | 01:18 | and a closing square-bracket.
| | 01:20 | Again, we can make the state columns
wider by clicking and dragging the field.
| | 01:24 | The text that I put between the
square-brackets will become a prompt in a
| | 01:27 | textbox when we run the query.
| | 01:29 | Let's run it to see.
| | 01:30 | I'll switch it to Data Sheet View,
and we get this Enter Parameter Value
| | 01:34 | textbox, Which state would you like?
| | 01:36 | Here I can type in the abbreviation
TX for Texas, and press OK.
| | 01:40 | The query record set displays all of the
customers that live in the state of Texas.
| | 01:45 | We can rerun this query by pressing
this Refresh button or by switching
| | 01:48 | back-and-forth between
Design View and Datasheet View.
| | 01:51 | I'll press Refresh Here.
| | 01:53 | We get the Enter Parameter Value box again.
| | 01:55 | This time, I'll type CA for California,
and press OK, and there is all of our
| | 02:00 | California customers.
| | 02:02 | It's simple, flexible, and very fast.
| | 02:05 | We can also combine parameter requests
with some of the other query criteria
| | 02:09 | tricks that we've seen earlier in the course.
| | 02:10 | For instance, we can combine one with a
wildcard character to filter last names to
| | 02:14 | a specific character.
| | 02:16 | Let's go back into Design View here,
and I'll delete the State criteria.
| | 02:20 | Underneath our LastName here, I'll
write it out a parameter request that uses a
| | 02:25 | wildcard character. All right.
Like, open square-bracket, enter first character
| | 02:32 | of LastName, closing square-bracket,
I'll then type ampersand, which will simply
| | 02:38 | join whatever I type in the Parameter
Request box to this asterisk character
| | 02:43 | that I wrap in quotation marks.
| | 02:45 | Let me enlarge this field so
we can see the whole thing.
| | 02:48 | So it reads Like, open square-bracket,
Enter First Character of last name,
| | 02:53 | closing bracket, ampersand, quotation mark,
asterisk, and the final quotation mark.
| | 03:00 | Okay, let's go ahead and run this query.
| | 03:02 | I will view its datasheet. We get the
Parameter Request box: Enter First
| | 03:06 | Character of LastName.
| | 03:07 | Here I can type in A and press OK and
now Access returns all of the customers
| | 03:12 | whose last name starts with the letter A.
| | 03:14 | If I press Refresh and type in a different
character, this time, I'll type M, say OK.
| | 03:20 | Now we get all the customers
whose last name starts with M.
| | 03:23 | Parameter Requests add another level of
customization to your database processes
| | 03:27 | and it can allow you to quickly build
a query framework that can answer an
| | 03:31 | infinite number of queries.
| | 03:32 | Whatever we type into the Parameter
Request box gets populated into the Criteria
| | 03:36 | field and it allows us to create one
query that answers lots of questions,
| | 03:40 | rather than creating many queries,
it only answer one question each.
| | Collapse this transcript |
| Building expressions| 00:00 | In all of the queries that we've built
so far, we focused on starting with the
| | 00:04 | data that is in our tables, and then
filtering it using a variety of techniques.
| | 00:08 | Another very powerful ability of queries
is to create new columns that are
| | 00:12 | calculated from the existing data columns.
| | 00:14 | The advantage of this is that we don't need
to actually store this data in the database.
| | 00:19 | We simply calculate it when we need it,
and get rid of it when we don't. In our
| | 00:23 | database, we have our employees' annual salary.
| | 00:25 | If I open up the Employees table, we can
see that over on the far-right side, here.
| | 00:29 | Let's go ahead and close that table.
| | 00:31 | We can create a query that will calculate
the biweekly paycheck amount from that salary.
| | 00:36 | We'll go to the Create Tab, and Query Design.
| | 00:39 | I'll add the Employees table.
| | 00:42 | I'll press Add and Close.
| | 00:44 | Then from that, I'll choose the
FirstName, LastName, and I'll scroll down, and
| | 00:50 | double-click on Salary.
| | 00:51 | In the fourth column is where we're
going to enter in our calculation.
| | 00:54 | I'm going to right-click on the
fourth column, and go to Build to launch
| | 00:58 | the Expression Builder.
| | 00:59 | I can also get to the Expression
Builder by clicking the Builder button up
| | 01:02 | here on the Ribbon.
| | 01:04 | Either way will take you to the same tool.
| | 01:06 | I'll use the right-click
menu and say Build here.
| | 01:10 | And that brings up this Expression Builder.
| | 01:12 | The Expression Builder is a tool that
has a lot of depth, and it definitely
| | 01:16 | rewards exploration.
| | 01:17 | On the left side, we have an
Expression Elements, which include groups for
| | 01:20 | Functions, and database objects.
| | 01:22 | We are going to open up the NoObstacles
group here, and in the Tables group, and
| | 01:28 | within the Tables group, we see a list
of all of the tables in our database.
| | 01:32 | I'll click on the Employees table.
| | 01:34 | Now in the second pane, we get a
listing of all of the fields from that table.
| | 01:38 | I'll scroll down, and I'll double-click
on Salary to add that up to the
| | 01:41 | expression syntax up above.
| | 01:43 | Now we just need to finish the formula.
| | 01:45 | I'll say divide it by 26.
| | 01:47 | There is 26 pay periods in a year.
| | 01:49 | We'll go ahead, and say OK, and
Access adds that expression into our
| | 01:54 | calculated field here.
| | 01:56 | It gives it a name too, Expr1,
and that's not very descriptive.
| | 02:00 | So I am going to highlight
that and rename it Bi-Weekly.
| | 02:05 | Make sure you keep the colon after that.
| | 02:08 | Now we can go ahead and
run this to see the results.
| | 02:11 | Now there is a lot of decimals
here, so it might not be wide enough.
| | 02:15 | I'll drag this open to view the whole
number and now we can see the Biweekly
| | 02:19 | paycheck amount for each employee.
| | 02:20 | Now we can clean up this data
a little bit back in Design View.
| | 02:24 | Go back to Design View, and I'll make sure
that I've selected this fourth column here.
| | 02:28 | Now just like when we created our columns
in our tables, we had to define which
| | 02:33 | data type we used, we
can do the same thing here.
| | 02:35 | Since we've calculated this, we can go
up to the Property Sheet by opening the
| | 02:39 | Properties here, and telling
it the format here is Currency.
| | 02:44 | That will clean up the numbers.
| | 02:47 | Let's go ahead and close the
Property Sheet, and rerun it to view.
| | 02:50 | Now that's a lot cleaner.
| | 02:52 | Let's go ahead and create another expression.
| | 02:54 | I'll go back into Design View.
| | 02:57 | And in the next column over, we'll
create a new expression that calculates
| | 03:01 | initials from our first and last names.
| | 03:03 | I'll right-click once again, and go to
Build, and this time I am going to go
| | 03:08 | into our Functions group.
| | 03:09 | Inside Functions, we'll find a listing
of functions called Built-In Functions.
| | 03:13 | And then in the Expression Categories
here, in the second column, we'll scroll
| | 03:16 | down until we get to our Text functions.
| | 03:19 | Within the Text functions group,
we'll find a function called Left, here.
| | 03:25 | We can see when we click on it, the
Left returns a specified number of
| | 03:29 | characters from the left side of a string.
| | 03:31 | I'll double-click on it to add
it up into my Expression Builder.
| | 03:34 | The Left function requires two arguments;
| | 03:36 | a string and the length that we want.
| | 03:39 | I'll click on the word String here.
| | 03:41 | Now this first part is going to extract
the first character from the first name.
| | 03:47 | I can find the first name by going
back into my NoObstacles element here into
| | 03:52 | the tables, into my Employees table,
and I'll double-click on FirstName.
| | 03:57 | It adds the syntax up at the top.
| | 03:59 | The Length, I'll click there, is going to be 1.
| | 04:02 | So that will extract the first
character from our first name.
| | 04:06 | Now we need to do the same thing to
get the first character from our LastName.
| | 04:10 | I'll type an Ampersand because we're
going to join these two together, and
| | 04:14 | we'll repeat the process.
| | 04:15 | Go back up to Functions>Built-In
Functions, scroll down to Text, scroll down to
| | 04:21 | Left and double-click.
| | 04:23 | Then where it says string, I'll click
there to select it, go into my database,
| | 04:28 | the Tables, scrolling down
into the Employees table.
| | 04:32 | And finally, I'll double-click on the LastName.
| | 04:36 | The Length again is going to be 1.
| | 04:37 | We'll go ahead and say OK, and
Access adds that expression down into
| | 04:42 | our calculation here.
| | 04:43 | Again, it gives it a new column name.
| | 04:45 | I'll highlight the Expr1
and change this to Initials.
| | 04:49 | Go ahead and say View to run the
datasheet, and we'll see now we've got the
| | 04:53 | Bi-Weekly amount in dollars, and we
also have the employees' Initials here as a
| | 04:58 | second calculated column.
| | 05:00 | The Expression Builder is a complex
tool that helps build proper syntax when
| | 05:04 | using calculations and formulas.
| | 05:06 | I definitely recommend spending some time
with the Expression Builder to take a
| | 05:09 | look at some of the nearly 200 built-in
functions that come with Access.
| | 05:14 | And if you'd like to get some additional
help using the Expression Builder, take
| | 05:17 | a look at my Access 2010 Queries in Depth
ourse available here at lynda.com.
| | Collapse this transcript |
| Obtaining summary statistics| 00:00 | Most queries return a record set, that
temporary table of all the records that
| | 00:04 | match your chosen criteria.
| | 00:06 | Once you've gathered your records together,
you can then tell Access to provide
| | 00:10 | some summary statistics
about the record that's gathered.
| | 00:13 | This is called a Totals Query.
| | 00:14 | Let's see how we can use one to gain
some insight into the performance of
| | 00:18 | NoObstacles across the various
regions that we market to.
| | 00:21 | I am going to start a new query in Design View
by going to the Create Tab>Query
| | 00:25 | Design and I am going to add a couple of tables.
| | 00:29 | I am going to add the Orders
table and the States table.
| | 00:32 | Now we can see in the background
that those two tables aren't directly
| | 00:35 | related to each other.
| | 00:36 | I'll need to add an additional
couple of tables to provide a link.
| | 00:40 | We are going to add-in the Products table,
and the Customers table.
| | 00:44 | We'll go ahead and close the Show Table window.
| | 00:46 | Now we can see that we have an unbroken link
from table to table to table.
| | 00:50 | I'll rearrange them, so it's a little bit
clearer what's going on here.
| | 00:54 | Now we can see that we have a customer,
the customers live in specific states,
| | 00:58 | the customers place an order for products.
| | 01:01 | Now from these tables,
I am going to add-in a few fields.
| | 01:04 | From the States table, we're going to
double-click on RegionName, and from the
| | 01:08 | Orders table, I want to choose
ReceiptID and Quantity.
| | 01:13 | Now if I run this query right now,
we'll see that we just get a listing of all
| | 01:17 | the receipts here, which region they
came from, and how many products were
| | 01:21 | ordered on that receipt.
| | 01:22 | Let's switch back into Design View.
| | 01:24 | I am going to change this record set
now into a Totals Query by pressing the
| | 01:28 | button at the top here in
the Show/Hide group, Totals.
| | 01:31 | When I do that, you will notice a new
row shows up down on the grid below,
| | 01:35 | Totals here, and everything is set to Group By.
| | 01:38 | In this row, we'll choose the summary
statistic type that we would like to
| | 01:42 | apply to each column.
| | 01:44 | We want to see each of our regions.
| | 01:45 | So I am going to leave that as Group By.
| | 01:48 | For ReceiptID, I'd like to see how
many sales we have in each region.
| | 01:51 | I'll change this to Count using the dropdown.
| | 01:54 | For the Quantity, we'd like to get
the total number of products sold.
| | 01:58 | I am going to change this one to Sum.
| | 02:00 | Now I can actually add some additional
quantity fields to get additional statistics.
| | 02:05 | I'll go back up to the Orders table, and
I'll double-click on Quantity three more times.
| | 02:10 | I am going to change their totals
to Average, Min, and Max.
| | 02:15 | Finally, I can include a calculated column,
by typing in the formula here in this last field.
| | 02:20 | I'll type [price]*[quantity].
| | 02:28 | This will multiply whatever is found in
the Price column by whatever is found in
| | 02:34 | the Quantity column from our tables.
| | 02:37 | From that, I can change its statistic to Sum.
| | 02:40 | This will give me the grand total of all
of the orders placed within the region.
| | 02:44 | Let's go ahead and run this
query to see the difference.
| | 02:47 | We'll run it, and we'll see
each of our region names.
| | 02:50 | Within each region, we can see how
many IDs or how many receipts have been
| | 02:55 | collected within each region.
| | 02:57 | I can see that the Northeast region
only has 29 total receipts.
| | 03:00 | The SumOfQuantity tells us
how many products were ordered.
| | 03:05 | The AvgOfQuantity, and I'll have to
enlarge this to see it, tells me the average
| | 03:09 | number of products per receipt.
| | 03:11 | The MinOfQuantity tells me the lowest
number of products on a receipt, in this
| | 03:16 | case, the lowest number we had was 2.
| | 03:19 | The MaxOfQuantity tells us the most
number of products ordered on any one
| | 03:22 | receipt in that region, in this case, 50.
| | 03:25 | And finally, we can see the total value that
each region has contributed to the company;
| | 03:30 | $146,000 in the Northeast region.
| | 03:33 | With the Totals query, I can quickly
see that the Northeast region is
| | 03:36 | underperforming with only 29 total sales.
| | 03:39 | But I can also see that the average
number of products per sale is right on
| | 03:42 | track with our other regions.
| | 03:44 | From a management perspective,
this is a pretty valuable insight.
| | 03:48 | Instead of focusing our attention on
selling more products to each customer,
| | 03:51 | we should focus our energies in the Northeast
region on gaining more customers overall.
| | 03:56 | Turning on the Totals row in Design View
unlocks several ways that I can collect
| | 04:00 | many records into a group such as our regions
here, and then display the summary
| | 04:04 | statistics across all of the records in each group.
| | Collapse this transcript |
|
|
6. Working with Specialty QueriesUsing update queries| 00:00 | All of the queries that we've looked at
so far were examples of Select Queries.
| | 00:04 | These are queries that merely look
through your data tables, and pull out
| | 00:07 | the relevant records.
| | 00:09 | There is a second class of
query called Action Queries.
| | 00:11 | These will go through your data tables,
and actually make changes to the data within.
| | 00:15 | When used properly, they can be extremely
useful to help change large amounts
| | 00:19 | of data very quickly.
| | 00:20 | They can also quickly create
huge headache if things go awry.
| | 00:23 | So make sure you have a backup in place
whenever you attempt to run an action query.
| | 00:27 | The first one that I want to take a
look at is called the Update Query.
| | 00:30 | To begin, we'll start in the familiar
Query Design View by going to the Create
| | 00:35 | Tab, and starting a new query
with the Design View here.
| | 00:39 | Now let's suppose that NoObstacles
decides to automatically enroll all of the
| | 00:43 | full-time employees in the company's
retirement benefit program.
| | 00:47 | We can create an update query to add the benefit
flag to employees based off of their status.
| | 00:52 | I am going to add employees to the Query Grid,
and then press the Close button
| | 00:56 | to dismiss the Show Table window.
| | 00:59 | From the Employees table,
I am going to choose a few fields.
| | 01:02 | I'll double-click on EmployeeID,
FirstName, LastName.
| | 01:04 | I'll scroll down and pick up Status,
and a little further, scroll down, and
| | 01:11 | get BenefitRetirement.
| | 01:13 | We'll double-click on each one
to add them to the grid below.
| | 01:16 | Now I am going to add
some criteria to my query.
| | 01:19 | Underneath Status, I am going to type
in 'full-time' in quotation marks.
| | 01:22 | This will filter my query results
to only the full-time employees.
| | 01:28 | I can run the query at this
point and see the results.
| | 01:31 | I can see that I have 393 full-time employees,
and I can see that some of them
| | 01:35 | are already receiving our retirement
benefits, but some are not.
| | 01:39 | Let's go ahead and switch back into Design View.
| | 01:40 | I am going to press the Update button
here on the Ribbon to convert this query
| | 01:46 | from a Select query into an Update query.
| | 01:49 | When I do that, we get a new row
down here in the Query Design grid.
| | 01:52 | Underneath BenefitRetirement, in that
Update To row, I am going to change this to Yes.
| | 01:58 | When I tab out of that field,
Access capitalizes the word Yes.
| | 02:01 | And basically, this just means that
whatever is in this field is going to get
| | 02:05 | changed to a Check or Yes.
| | 02:07 | Now with all of the action queries,
running the query here and viewing the
| | 02:12 | datasheet are two very different things.
| | 02:15 | I'll click on the View button to view
the fields that are about to change.
| | 02:18 | These are all the checkboxes that
will be affected by the Update To row.
| | 02:22 | I'll go ahead and switch back into Design View.
| | 02:25 | And now when I press Run here, Access
will go ahead and convert those changes.
| | 02:30 | Here, I'll get a warning saying 'You are
about to update 393 row(s).' Once you
| | 02:34 | click Yes, you can't undo this command.
| | 02:37 | Remember, changes to data
are saved automatically.
| | 02:41 | If you are sure you want to make the changes,
go ahead and press Yes, here.
| | 02:44 | The changes have been made, and we
can go back and view our datasheet again
| | 02:48 | to see the results.
| | 02:50 | If we want to see the results in context,
we can also return to the
| | 02:53 | Employees table here.
| | 02:54 | I'll open up the Employees table,
and I'll scroll across.
| | 02:58 | And now, any of the full-time employees
should have the BenefitRetirement field checked.
| | 03:03 | The Update Query can make quick work
of updating lots of records at once.
| | 03:08 | The advantage to using a query to do
this work over the Table tools' Find &
| | 03:11 | Replace option, is that you can leverage
everything we've explored in
| | 03:15 | filtering and using query criteria to target
or limit the updates to very specific records.
| | Collapse this transcript |
| Using make table queries| 00:00 | The Make Table action query is useful
if you would like to convert a query's
| | 00:04 | temporary record set into a standalone table.
| | 00:07 | This is perfect for exporting a snapshot
of the data as it exists today.
| | 00:12 | Remember, that queries by their nature
update automatically to show the
| | 00:16 | current state of the data.
| | 00:17 | By exporting the results to a new table,
you can essentially freeze their results.
| | 00:22 | Right now, the NoObstacles employee table
includes our 2012 salary and job ratings.
| | 00:28 | Before the manufacturing department
head can go through and update them for
| | 00:31 | 2013, we would want to create an archive table
so we can go back and see how
| | 00:37 | things have changed from year to year.
| | 00:39 | I am going to go up and create
a new query in Design view.
| | 00:42 | We're going to add the Employees table
and close the Show Table window.
| | 00:47 | Now we'll start populating our grid
with some fields from the Employees table.
| | 00:51 | I'll add the EmployeeID, FirstName,
LastName, the Department and I'll scroll
| | 00:57 | down and add Status, Salary and JobRating.
| | 01:07 | Now we would like to add
a criteria to our department.
| | 01:09 | We're going to focus on just the Employees
in the manufacturing department.
| | 01:13 | Now I'm gong to write this out here
using a wildcard character so that I can
| | 01:17 | grab all of the manufacturing departments,
including manufacturing and
| | 01:20 | manufacturing administration.
| | 01:22 | So I'll write the word like manufacturing*.
| | 01:25 | When I press Enter, Access adds in the
quotation marks for me and I can expand
| | 01:31 | the field here to see the entire result there.
| | 01:34 | Let's go ahead and view our
datasheet to confirm the results.
| | 01:37 | I'll click here and I can see that
I've got a total of 158 total employees
| | 01:43 | in the Manufacturing Department, including
if I scroll down Manufacturing Administration.
| | 01:49 | Now let's go back into Design view and
convert this into a Make Table query.
| | 01:52 | I'll switch to my View and I'll go up here
in the Query Type group on the Design
| | 01:58 | tab and I'll change this query from a
Select query into a Make Table query.
| | 02:03 | Access asks us to name the new table.
| | 02:05 | I'm going to call it, Manufacturing Employees 2012.
| | 02:10 | We're given the option to save this
table in the Current Database or we can
| | 02:14 | store it an external archive database if we prefer.
| | 02:17 | I'm going to keep it in the Current Database.
| | 02:19 | We'll go ahead and say, OK.
| | 02:22 | Nothing really changes down here in the Query Grid.
| | 02:24 | But if we run it, Access still tell us that
we're about to paste a 158 rows into a new table.
| | 02:30 | That's exactly what we want, so I'll
go ahead and say, Yes, and the new table
| | 02:33 | is created over here.
| | 02:35 | If I open it up to take a look,
you'll see it includes only the 158
| | 02:38 | Manufacturing, and I'll open this
us up again, and scrolling down
| | 02:43 | Manufacturing Admin employees.
| | 02:45 | The Make Table query is a great way to copy a
large number of records into a permanent table.
| | 02:50 | It sets up the table structure, defines
the field headings and data types and
| | 02:54 | populates all of the records in a single step.
| | Collapse this transcript |
| Using delete queries| 00:00 | It probably goes without saying,
what the Delete Query does.
| | 00:04 | By using our knowledge of query criteria,
we can set up a Delete query to
| | 00:08 | selectively remove records from the database.
| | 00:10 | This is a permanent and destructive edit
that we're going to make.
| | 00:13 | So again, make sure you have a solid backup
of your database in place before proceeding.
| | 00:18 | Let's suppose we've been tasked with
removing the records for all canceled
| | 00:22 | orders that were placed in 2011
and are now over a year old.
| | 00:26 | If we open up the Orders table here
we'll see the orders that were placed in
| | 00:31 | 2011, and here and there we've got some orders
that were canceled for one reason or another.
| | 00:36 | To remove those from the database we'll
use a Delete Query in several criteria.
| | 00:40 | Like the other action queries the
Delete query starts off as a regular Select
| | 00:43 | query in Design view.
| | 00:45 | I'll go to Create and Query Design.
| | 00:48 | We're going to add the Orders table
to our query and press Close.
| | 00:52 | Now we'll add in a few fields.
| | 00:54 | I'll add the ReceiptID,
the Purchase Date and the Status.
| | 01:01 | I don't need to add the other fields
because they're not relevant to my criteria.
| | 01:05 | But remember, way back at the beginning
when I said that records represented in
| | 01:08 | unbreakable unit all the way across the row?
| | 01:11 | Even though every field won't be in the
Delete query, if a record is deleted its
| | 01:16 | information will be removed from every field.
| | 01:19 | We're going to add in some criteria
to our delete query here.
| | 01:22 | For the date, I'm going to put in <=12/31/2011.
| | 01:29 | I'll press Tab to move over to the criteria
for the Status and here I'm going to
| | 01:33 | type in canceled and press Enter
to accept that change.
| | 01:38 | Now I can safely run this query
to see the four records that match.
| | 01:42 | I'll change it to Datasheet view here
and there are the records that are
| | 01:45 | going to be deleted.
| | 01:46 | I'll switch back into Design view,
and at this point we'll convert it from a
| | 01:51 | Select query to a Delete query using this button
here in the Query Type group on the Design tab.
| | 01:56 | Now it's a Delete query and when I
press Run, I'll get the warning, that I'm
| | 02:00 | about to delete 4 rows from the specified table.
| | 02:03 | Once you click Yes, you can't undo
the command to reverse the changes.
| | 02:07 | Are you sure you want to delete the selected records?
| | 02:10 | Yes, let's go ahead and delete them from the database.
| | 02:12 | When you press Yes, those records are gone.
| | 02:15 | We can confirm this by closing the query.
| | 02:18 | I don't need to save any changes
because it won't work again, there aren't
| | 02:21 | anymore records to delete.
| | 02:23 | And now if I take a look at my Orders table,
I'll see these rows saying Deleted.
| | 02:26 | If I press Refresh, those are gone from the database.
| | 02:30 | Once you run a Delete Query,
those records are immediately deleted.
| | 02:33 | There is no Undo ability to get them back.
| | 02:35 | So make sure that you've checked the
results out thoroughly, when you're still in
| | 02:38 | the Select query mode, before
converting the query to a Delete query.
| | 02:42 | If you make a mistake with a Delete query
your only recourse is to return to
| | 02:46 | that all-important backup.
| | Collapse this transcript |
| Using append queries| 00:00 | When you want to permanently join the
contents of two tables together, you can
| | 00:04 | use an Append query to
make quick work of a task.
| | 00:07 | NoObstacles recently added to the
available colors in their line of bath
| | 00:10 | towels and we've received a table here,
NewProducts from the manufacture
| | 00:14 | detailing the new specifications.
| | 00:16 | We can see the bath towels here and
the new color options that are available.
| | 00:20 | Rather than manually typing all of this
into our existing Products table, we can
| | 00:24 | create an Append query to do the work for us.
| | 00:26 | I'm going to close the NewProducts table
and start a new query in Design view.
| | 00:31 | On the Create tab, press Query Design.
| | 00:33 | Let's add the NewProducts tables to our query
and I'll close the Show Table window.
| | 00:40 | And now, we're going to add the fields
from the table down into our Query Grid.
| | 00:44 | I'm going to grab all of the fields
except for the ProductID, the primary key.
| | 00:48 | So I'll add Product, Department,
Category, Size, scrolling down we'll grab
| | 00:54 | Color, Price, Description
and finally the Rating.
| | 00:59 | Since our Products table is set to create
an auto number ID, each of these new
| | 01:03 | products will automatically be assigned
a new ID when they get appended to the
| | 01:06 | full product listing, in order to
ensure that there are no conflicts.
| | 01:11 | Now let's go ahead and change this query
to an Append query here on the ribbon.
| | 01:16 | Access will ask us which table we
want to append these records to.
| | 01:19 | I can use the dropdown list to
choose our Products table here.
| | 01:25 | We also have the option to append to
another table in a different database.
| | 01:28 | We'll go ahead and say, OK and
Access adds this Append To row down here.
| | 01:34 | These are the fields from the existing
Products table that we're going to append to.
| | 01:38 | Now because the field names in both
tables are the same, Access has already
| | 01:42 | correctly matched them all up.
| | 01:44 | If your fields have different names
among the two tables, then you may need to
| | 01:47 | manually tell Access which data goes into which field.
| | 01:51 | Once we've verified that all of the
data will go into the right location, I'll
| | 01:55 | press the Run button on the ribbon.
| | 01:58 | Access tells us that we're about to append
21 rows, once you click Yes you can't undo it.
| | 02:03 | Go ahead and press Yes to append those records.
| | 02:05 | Now I can close this query, I don't
need to save it because they are already
| | 02:09 | added and I don't want to add a duplicate copy.
| | 02:12 | Go ahead and say, No we
don't want to save those changes.
| | 02:15 | Now we take a look at our Products table
here and we'll see that we have a total
| | 02:19 | of 321 products now, instead
of the 300 we had previously.
| | 02:22 | And if I scroll to the very bottom,
you'll see the new bath towels and the new
| | 02:28 | color options added to the bottom.
| | 02:30 | Anytime you need to add lots of records
to your database and they're coming from
| | 02:33 | a pre-tabulated source such as an Excel
file or another spreadsheet, take a look
| | 02:38 | at using an Append query before you try
and manually retyping everything to get
| | 02:42 | it into your database.
| | 02:44 | Whether you have 10 records or
10,000 records you'll be finished with
| | 02:47 | the task in no time.
| | Collapse this transcript |
| Getting a different look with crosstab queries| 00:00 | Queries generally follow the rows and columns
or records and fields model for their layout.
| | 00:05 | There's also a slightly modified layout
option called the Crosstab query, that
| | 00:09 | gives us headers along the top and side and
aggregate or summary data appears in the middle.
| | 00:13 | Let's put one together using our phone list
so you can see how this works.
| | 00:18 | Now right now our EmployeePhone lists
are stored in a second related table.
| | 00:22 | This provides flexibility in adding multiple
numbers for each employee where
| | 00:26 | most employees will have at least one
office phone, but some might have
| | 00:30 | additional lines for their cell phone,
their fax number or their home phone or
| | 00:33 | an emergency contact number.
| | 00:35 | I would like to first put together a
Select query that gathers all of these
| | 00:39 | numbers and then convert that query
into a Crosstab format, so you can see the
| | 00:43 | improvement in legibility.
| | 00:44 | I'll go ahead and close the EmployeePhone
table and we'll start a new query in Design view.
| | 00:49 | I'll add the Employees table and the EmployeePhone
table and close the Show Table window.
| | 00:57 | Now I'll pull in a few fields.
| | 00:58 | From the Employees table I'll double-click
on FirstName and LastName and from
| | 01:02 | the EmployeePhone phone table
I'll grab the Number and the Type.
| | 01:05 | Let's go ahead and view the datasheet
to see the records we've collected.
| | 01:09 | You'll see multiple lines for each
employee which is not quite ideal.
| | 01:13 | Let's go back into Design view and clean it up.
| | 01:15 | I'm going to change the Query Type from
Select query over here to Crosstab query.
| | 01:19 | When I do that I get two additional rows
down here in the grid, Crosstab and Total.
| | 01:24 | In the Crosstab row we're going to
define what fields go where in the grid.
| | 01:29 | Our first and last names
are going to be Row Headings.
| | 01:33 | I'll click the dropdown
and choose the Row Heading.
| | 01:36 | The Type will become our Column Heading
and the number is what's going to appear
| | 01:40 | in the middle, we're going to choose Value.
| | 01:43 | Now also for the number we need to
choose how we want to show those values.
| | 01:46 | We're going to change this Totals row to First.
| | 01:49 | The Total is how we want to aggregate
or summarize the data in this area.
| | 01:53 | Most of these options will make sense
for numerical data such as sum or average
| | 01:57 | but wouldn't make any sense for phone numbers.
| | 01:59 | We'll choose First here, so that we're
not applying any sort of mathematical
| | 02:04 | transformations to the data.
| | 02:06 | Now finally I want to make this a
usable directory so I'm going to apply a Sort
| | 02:09 | on LastName to alphabetize it ascending.
| | 02:12 | Now let's go ahead and view the
datasheet to see the difference.
| | 02:16 | It's exactly the same data as before
just displayed in a more compact way.
| | 02:21 | Each employee now only has one row but
we still see all of their phone numbers
| | 02:25 | with a type listed across the top. Further,
| | 02:29 | this layout makes it very easy
to see what employees are missing
| | 02:32 | crucial information.
| | 02:33 | Maybe it's time to put some
pressure on people to give us those
| | 02:36 | emergency contact numbers.
| | 02:38 | Crosstab queries can provide a different
organization to your data, sometimes
| | 02:42 | making it easier to read,
make comparisons or spot trends.
| | 02:46 | The aggregate values that appear at the
intersection of the row and column can
| | 02:50 | also be set to display account of how
many records are in that group or their
| | 02:54 | sum total, average, lowest, or highest values.
| | Collapse this transcript |
| Creating a union query in SQL view| 00:00 | The Query Design view is exceptionally
powerful and it allows you to create a
| | 00:04 | query for nearly any scenario
that you can imagine.
| | 00:07 | However, it really is just a front end
to something even more powerful that's
| | 00:10 | happening in the background.
| | 00:11 | When you create a query in Design View,
Access is translating those instructions
| | 00:16 | into code called
Structured Query Language or SQL.
| | 00:20 | You can see the code for the queries
that you created by switching into the
| | 00:23 | third view mode SQL.
| | 00:25 | I'll double-click on the EmployeePhoneNumbers
query to run and then go up to
| | 00:29 | View menu and click on the bottom
half and change my View to SQL View.
| | 00:34 | Now I'm not going to be able to
get into writing queries in SQL.
| | 00:37 | There are other courses in the lynda.com
library that cover this in-depth topic.
| | 00:41 | But I thought it would be helpful for you
to get just a taste of what this looks like.
| | 00:46 | The snippets of code that you see here
is literally everywhere in Access and the
| | 00:50 | more familiarity you have with its structure
and syntax conventions, the easier
| | 00:54 | it will be for you to create
amazing database applications.
| | 00:57 | But for now, I want to walk you through
the creation of one query type that you
| | 01:01 | actually cannot create using the Design View.
| | 01:04 | The Union query is useful when you want
to temporarily join two tables together.
| | 01:09 | Unlike the Append query which permanently
copies data from one table and saves
| | 01:13 | it into another, the Union query keeps
the original data tables untouched, but
| | 01:18 | returns a temporary record set that functions
exactly as if you had joined them together.
| | 01:23 | So let's go ahead and close this
EmployeePhoneNumbers query.
| | 01:25 | I'm going to start a new query in
Design view by going to Create>Query Design.
| | 01:31 | Now let's suppose that NoObstacles has
products split up by category to coincide
| | 01:36 | with the structure of their management team,
with separate tables for the
| | 01:39 | Furniture and Textiles products.
| | 01:43 | The Furniture Manager typically doesn't
much care about the textiles and vice versa.
| | 01:47 | However, occasionally we do need to
take a look at the entire product line.
| | 01:51 | We can keep these tables separate for
day-to-day management, but create a Union
| | 01:55 | query for those rare times when we want to
look at the entire group of products together.
| | 02:00 | Here in my Query Design view I'm going
to add the Products-Furniture table and
| | 02:05 | press Add and close Show Table.
| | 02:08 | A shortcut to add all of the fields to
the Query Grid is to double-click on the
| | 02:12 | Asterisk (*) character at
the top of the field list.
| | 02:14 | I could run my query in Datasheet view,
to confirm that I am indeed grabbing all
| | 02:17 | of the fields from that table.
| | 02:20 | Now I'll switch my View into SQL and
we'll see the syntax that generated that
| | 02:24 | query, it says SELECT[Products-Furniture].*
FROM[Products-Furniture] table.
| | 02:31 | There is a semicolon
| | 02:32 | at the end here and I'm going to click
before that and press Enter a few times
| | 02:36 | to move that semicolon down on the page.
| | 02:38 | Now we just need to use this as a model
to type out the rest of our Union query.
| | 02:43 | I am going to go ahead and type the word
UNION, press Enter a few more times and
| | 02:48 | I am going to follow this with a
reference to the Products-Textiles table.
| | 02:51 | Now I'm just going to copy
the syntax that I see up above.
| | 02:54 | So I'll write SELECT [Products.Textiles].*
| | 02:59 | I'll press Enter to go to the next line,
FROM [Products-Textiles] and there we
| | 03:12 | go, that's the extent of my Union query.
| | 03:14 | Now I can run this query to see the
results and I can scroll through the list to
| | 03:18 | see that indeed we have products in the
Category Textiles and if I scroll down
| | 03:23 | we'll get products in the Category Furniture
all merged together.
| | 03:27 | Let's go ahead and save this query here.
| | 03:29 | I'll go up and press the Save icon on
the Quick Access toolbar and I'll save
| | 03:32 | this as All Products Union Query and press OK.
| | 03:38 | You'll notice that it shows up in the
Navigation pane with a different icon
| | 03:41 | indicating that this is a Union query.
| | 03:43 | Now whenever I want to build a report
or form or query off of just a single
| | 03:47 | department, I'll use these tables as a source.
| | 03:50 | If I want to build out form or report or
query based off of the complete listing
| | 03:54 | of all products, I'll use this
Union query as the source.
| | 03:57 | The Union Query is a great example of
the type of thing that's possible with
| | 04:01 | just a smidge of SQL knowledge.
| | 04:03 | Gaining experience with Structured
Query Language is something that I
| | 04:06 | would highly recommend when it comes time
to take your Access skills to the next level.
| | 04:10 | However, with the flexibility and control
you get with a Standard Query design
| | 04:13 | environment, it's really not required
knowledge for all but the most specialized
| | 04:17 | queries that you might want to construct.
| | Collapse this transcript |
|
|
7. Creating FormsUnderstanding the role of forms| 00:00 | The next Access object that we're
going to start working with is Forms.
| | 00:04 | Forms will create the main user interface
for your database and allow you to
| | 00:07 | set up navigation systems and group tasks in
ways that make sense for your organization.
| | 00:12 | I am going to open up some of the forms that
we will be creating over the next two chapters.
| | 00:17 | First, let's take a look at this
Training Department Employees form.
| | 00:20 | I'll scroll down here and
double-click to open it.
| | 00:23 | Forms provide a blank canvas for you to
populate with lots of objects in order
| | 00:26 | to manipulate the data and
functionality of the database.
| | 00:29 | You'll be able to add references to
table fields and records such as these text
| | 00:33 | boxes up here that I connected to
the name fields for our employees.
| | 00:37 | Each field on the form acts as a window
into a single cell on the source table
| | 00:42 | and any edits that you make on the
form get saved right back into the table.
| | 00:46 | You can add additional controls to your data.
| | 00:48 | On this form we can navigate through
our employees just like we can with the
| | 00:51 | table using the navigation
buttons at the bottom.
| | 00:55 | Or on this form I've got a search
box in the upper right-hand corner.
| | 00:59 | I can use the dropdown list to
quickly jump to a specific person.
| | 01:03 | I can even just start typing and press
Enter to jump to specific person as well.
| | 01:08 | Down here we've built an option group
to improve the way that we interact with
| | 01:12 | the job rating field.
| | 01:13 | On the table this is just a numerical
score of 1 through 5, but on the form
| | 01:18 | we can add descriptive display text that will
translate the number value in the background.
| | 01:23 | And forms will allow you to add buttons
that are attached to macros or visual
| | 01:27 | basic routines such as these
buttons here are on the right.
| | 01:30 | This one will add a new employee to
the database and this one here will
| | 01:33 | print their record.
| | 01:34 | I'll go ahead and press Cancel.
| | 01:36 | Forms will allow you to create a unique
experience for the users of your database
| | 01:40 | by adding images and using font and
color schemes that are pleasing to work with
| | 01:44 | and that support your organization's brand.
| | 01:47 | Primarily, Forms will be used
to interact with your data.
| | 01:50 | They typically display one record at a
time in a highly customizable way so that
| | 01:53 | you can see the entire picture of
how the related fields come together.
| | 01:57 | But you can also create forms to
display many records at a time.
| | 02:00 | Such as this Employee Phone List form.
| | 02:03 | This one is a scrolling list of phone numbers
that has a stylized header here at the top.
| | 02:08 | Finally, Forms can be used to organize
buttons into logical groupings of related tasks.
| | 02:12 | For instance with a Navigation Form,
like this one here, you can use buttons to
| | 02:18 | move from objects to object.
| | 02:22 | This completely bypasses the long list
in the Navigation pane, which I can safely
| | 02:27 | close and still be able to get
around through my database.
| | 02:30 | In fact, a well-crafted database often
bypasses the navigation pane altogether
| | 02:34 | as it means for moving from task to task.
| | 02:36 | This allows you to work in a way that
makes sense for your particular workflow
| | 02:39 | in sequence and as an added benefit, or
maybe even the most important benefit,
| | 02:44 | this also keeps people focused on the areas of
the database that they should be working with.
| | 02:48 | It can help keep them out of the
areas that should stay behind the scenes.
| | Collapse this transcript |
| Generating forms from tables| 00:00 | You can have a basic data entry form up
and running in as little as two clicks.
| | 00:05 | First, select the table you'll like to
create a form for in the navigation pane.
| | 00:09 | I'll choose the Employees table.
| | 00:11 | Then on the Create tab of the ribbon
press the Form button here.
| | 00:16 | Access sets up the form.
| | 00:17 | This form has cells that correspond to
a single employee's record in our table.
| | 00:22 | We can view this information or edit
it to make changes back in the table
| | 00:26 | and just like viewing a table we have the
same record selectors across the bottom here.
| | 00:31 | In addition to the text boxes that
hold information from the Employees
| | 00:34 | table Access recognizes the relationship
between Employees and the
| | 00:38 | EmployeePhones table.
| | 00:39 | If I just go down to the bottom
we can see that down here.
| | 00:43 | Access has created a sub-datasheet that displays
all of the related records for each employee.
| | 00:48 | Notice that that the sub-datasheet has
its own set of record selectors here.
| | 00:52 | We can also easily add additional
phone numbers in this field.
| | 00:56 | This illustrates one of the reasons why
forms are used for data entry over
| | 01:00 | entering data directly into tables.
| | 01:01 | We can use forms to enter information
into multiple tables simultaneously.
| | 01:05 | Plus you don't need to manually manage
the relationship between, in our case,
| | 01:09 | Employees and their employee phone numbers.
| | 01:12 | Because the form is currently displaying
a single employee, Access knows that
| | 01:16 | any phone numbers that we add belong to
that employee and the foreign keys will
| | 01:20 | get added automatically.
| | 01:22 | Let's add a new phone number and then
verify that it places it correctly it the tables.
| | 01:26 | I'm going to jump to record number 10
for our Employees by clicking in the box
| | 01:31 | and typing in 10 and pressing Enter.
| | 01:34 | Access jumps to the record number 10,
which is for our employee named Marc Navarro.
| | 01:38 | Let's scroll down and add a
new phone number for Marc.
| | 01:42 | Here down on the second section of
the sub-datasheet I'll press this new
| | 01:46 | Record button here.
| | 01:49 | Access adds a new phone number line for
Marc and we can start typing in the value.
| | 01:52 | Now remember that first field is a
primary key for the phone numbers.
| | 01:56 | We can't edit that number.
| | 01:58 | So I'll press the Tab key to move to
the next field and we'll enter in his
| | 02:02 | phone number 6501230000.
| | 02:07 | We'll go to Type and this is his home number.
| | 02:11 | I'll press Enter to accept those changes.
| | 02:13 | You'll notice that it got
a new ID number here 1803.
| | 02:17 | Now we can save and close this form.
| | 02:20 | I'll close it up here, Access will
prompt me to save the changes to the
| | 02:25 | Employees form and I'll say Yes.
| | 02:26 | I'll go ahead and accept that name and
say, OK, and we'll notice a new forms
| | 02:30 | group down here in the navigation
pane with our Employees form.
| | 02:34 | Now we can go ahead and open up the
EmployeePhone number table to verify that
| | 02:37 | the new number got entered correctly.
| | 02:39 | I'll double-click on EmployeePhone and
I'll use the Last Record button down here
| | 02:43 | in the bottom to jump to the very end of
the table and we can see that indeed we
| | 02:48 | have that new phone number
linked to EmployeeID number 10,
| | 02:50 | that's Marc's employee ID number, and there's
the number and the type that we entered.
| | 02:56 | Having Access create a basic form for
us probably couldn't get any easier.
| | 03:00 | Select the table you want
and press the Form button.
| | 03:03 | However, there's a lot of additional
functionality and customization that we can
| | 03:06 | build into our forms using the
Form Wizard in Design views.
| | Collapse this transcript |
| Adjusting form elements in Layout view| 00:00 | The one-click form got us started by
placing text boxes for all of our table
| | 00:04 | fields onto the form.
| | 00:06 | We can further refine the organization of
the Form elements by using the Layout view.
| | 00:10 | I'm going to open up the Employees
form that we started in last movie by
| | 00:13 | double-clicking on it in the navigation pane.
| | 00:15 | We can change our view here to
layout by clicking on the View button.
| | 00:19 | Now we're in Layout view.
| | 00:22 | Layout view allows us to rearrange and
add elements, but it keeps everything
| | 00:26 | organized on a standardized grid layout.
| | 00:29 | Right now the form is
organized into a single column.
| | 00:31 | We can rearrange this layout by
adding additional placeholder rows and
| | 00:35 | columns to our Layout grid.
| | 00:36 | On the Arrange tab of the ribbon go
ahead and press the Insert Right button
| | 00:40 | twice to add two additional columns
over here on the right side.
| | 00:44 | Now we can drag and drop these form
elements into these placeholders in the grid.
| | 00:48 | For instance, I'm going to take this
LastName field where it says Tate.
| | 00:52 | I'm going to drag-and-drop it over here
to the right of Zachary, the FirstName.
| | 00:57 | I can resize elements by clicking
on them and dragging on their edges.
| | 01:01 | Notice that when I do, it resizes
everything in that column.
| | 01:05 | I can resize the height by dragging
on the bottom and again it resizes
| | 01:08 | everything in that entire row.
| | 01:10 | The Layout view grid keeps everything organized.
| | 01:14 | Now I can delete labels that we don't
need such as this LastName label, by
| | 01:17 | clicking on it and pressing the Delete key.
| | 01:20 | If we want to edit a label,
I'll double-click on it.
| | 01:22 | For instance I'll double-click on this
First Name one and just change it to read
| | 01:26 | Name and press Enter.
| | 01:28 | Now we can continue to rearrange our
form elements into a more logical grouping.
| | 01:33 | I'm going to move Department over here
to the right and I'll grab the label for
| | 01:36 | Department and move that as well.
| | 01:38 | I'm going to move the Status
up and the Status label up.
| | 01:43 | If I want to grab multiple pieces
at once, I can click on one and then
| | 01:47 | Shift+Click on the other.
| | 01:48 | Let's move HireDate over to
the right of Status, here.
| | 01:52 | Our Benefit Information, let's
move it over to the right as well.
| | 01:55 | I'll click on BenefitDental and
then Shift+Click on this last checkbox.
| | 01:59 | That will grab all six elements at once.
| | 02:01 | We can drag and drop them in to position.
| | 02:04 | Let's go ahead and scroll down.
| | 02:06 | Salary and JobRating we can move those up.
| | 02:09 | I'll click on Salary, Shift+Click on the 5
and drag those up and drop them into position.
| | 02:15 | Let's get rid of the few rows
that we don't need anymore.
| | 02:17 | I'll click on this field and Shift+Click
on the fourth one and press Delete and
| | 02:22 | the entire row disappears.
| | 02:24 | Now let's go ahead and give more room
to our sub-datasheet here the bottom.
| | 02:28 | I'll click on the sub-datasheet,
Shift+Click on the other two fields to
| | 02:32 | the right of it, and I'm going to press
this Merge button up here on the ribbon.
| | 02:36 | That will merge those three fields together
giving our sub datasheet more room.
| | 02:40 | Now we can rearrange the fields inside of that.
| | 02:42 | I'm going to drag this ID open a
little bit more and give a little more
| | 02:45 | breathing room to our Number and Type.
| | 02:48 | Let's go ahead and scroll up to the top.
| | 02:50 | I can continue refining this a little bit more.
| | 02:52 | I am going to leave this row here
blank, but I'll use it as a spacer row.
| | 02:57 | I'll go ahead and click on Taft here,
the building row and I'll shrink that down.
| | 03:01 | The same thing with the rows below it.
| | 03:02 | I'll grab each one and make
them a little bit narrower.
| | 03:05 | That way we can fit more
information on our screen.
| | 03:12 | If we want to reduce the amount of
spacing between our elements, I can select
| | 03:15 | everything by clicking on this box here
and then going up to Control Padding and
| | 03:19 | choosing either None or the Narrow option.
I'll choose Narrow.
| | 03:22 | You can see that everything
collapsed together a little bit more.
| | 03:26 | Now that our form is a little bit more
organized, we can view the results of our
| | 03:30 | edits by changing back to Form View, by
going to the Home tab and changing our
| | 03:33 | View toggle button here.
| | 03:34 | That will change us into Form View and
we can cycle through the records to see
| | 03:37 | how it works with multiple employees.
| | 03:43 | If you need to make any changes, for
instance, I'm noticing that this Department
| | 03:46 | field isn't quite wide enough
for my entire departments.
| | 03:49 | I'll press the View button to toggle
back and I can make those changes.
| | 03:53 | Once I'm happy with the layout I'll go
ahead and press the Save button to save
| | 03:57 | those changes to the form.
| | 03:59 | The Layout view grid makes it very easy
to move your fields around quickly while
| | 04:03 | keeping everything perfectly aligned
and looking neat and clean.
| | Collapse this transcript |
| Using the Form Wizard| 00:00 | The Form Wizard will walk us through
some additional options we have when
| | 00:03 | creating a form, giving us more
flexibility in how the form is organized in a
| | 00:07 | simple, one-click method.
| | 00:09 | Let's create another form, this
time for our employee directory.
| | 00:13 | I'll choose the CREATE tab and
from there I'll choose Form Wizard.
| | 00:18 | We start with a screen that
might look familiar to you.
| | 00:21 | We saw the same thing when we
worked with the Query Wizard.
| | 00:24 | Essentially, we're going to use a query
in the background to assemble the data
| | 00:28 | for our form, so let's choose
a couple of fields here.
| | 00:30 | I'm going to choose from the Employees
table, the FirstName, the LastName and
| | 00:35 | we'll move those over, I'll also add
the Building and Department fields.
| | 00:39 | I'll then go back up here and change
from my Employees table to my
| | 00:44 | EmployeesPhone table, here.
| | 00:46 | From there I'll choose Number and Type.
| | 00:50 | The next step of the wizard gives us the
option of including the related data as
| | 00:53 | a subform or as a linked form.
| | 00:57 | The subform option is what the one-click
method created for us in the previous
| | 01:01 | movie, so let's see what the
linked form option look like.
| | 01:04 | I'll go ahead and choose that radio button.
| | 01:06 | We'll go ahead and say Next, we'll
give our form some descriptive names.
| | 01:10 | I'll call the first one Employee Offices
and the second one Phone Numbers.
| | 01:16 | Then we have the choice to either
open the main form to view or enter
| | 01:19 | information or Modify the design, I'm going
to choose to open them to view the information.
| | 01:24 | Press Finish and two new forms get
added into our forms group down here in
| | 01:28 | the Navigation Pane.
| | 01:30 | Now we are seeing the Employee Offices form.
| | 01:32 | Not all of the fields from the Employees
table are present, because we only
| | 01:35 | chose a select few to include here in
our form, just the ones that are important
| | 01:40 | for this particular task.
| | 01:42 | There is a button up top that links to the
Employee Phone Numbers in a separate form.
| | 01:46 | However, there is a little bug here in
Access in that this title appears above
| | 01:50 | the button and makes it un-clickable.
| | 01:51 | So we'll need to move that out of the way
really quick and we can do that in Layout View.
| | 01:56 | I'll change my View to Layout View, now
I can click on this title here and drag
| | 02:00 | it over here to the right.
| | 02:02 | Then I'll grab the button, drag that all
the way to the right side and then I'll
| | 02:06 | move the label back to the beginning.
| | 02:08 | Now let's switch back to our Form view.
| | 02:10 | Now we can click on this button here,
we're on the record for Zachary Tate, I'll
| | 02:14 | press the Phone Numbers button and we
can see all the Phone Numbers for Zachary.
| | 02:18 | So using the Form Wizard we have more
control over exactly what fields and
| | 02:22 | related tables get displayed on the Form.
| | 02:24 | Since this form is going to be used as
a directory, there really isn't a reason
| | 02:28 | to include salary and benefit information
here, that would just add clutter.
| | 02:32 | Keeping the form's content specific
to the designated tasks makes for
| | 02:36 | a much cleaner user experience.
| | Collapse this transcript |
|
|
8. Designing FormsCreating forms in Design view| 00:00 | Creating Forms in Design View requires
diving into a new design environment that
| | 00:04 | looks different than what we've seen previously.
| | 00:06 | I would like to take a few minutes to
just have a look around before we start to
| | 00:10 | create a new form in this view.
| | 00:12 | I'm going to start by going to the
CREATE tab and in the Forms group,
| | 00:15 | choose Form Design.
| | 00:17 | This will jump us into a new
Design View for a new form.
| | 00:20 | On the Ribbon we've got three new
contextual tabs, the first is the DESIGN tab.
| | 00:25 | This tab has options for changing our
View here on the left, adjusting our Font
| | 00:29 | and Color Themes, a large group of
Control objects that we can add to our form,
| | 00:34 | settings for our form's Header and
Footer and some form design tools that we'll
| | 00:39 | be making use of shortly.
| | 00:41 | The next tab is the ARRANGE tab.
| | 00:44 | Most of these tools deal with the Layout
View, but over here on the right you'll
| | 00:47 | find Sizing & Ordering.
| | 00:49 | These tools will help us precisely
align our objects within the grid.
| | 00:53 | The next tab over is the FORMAT tab.
| | 00:55 | The FORMAT has sections for selecting
objects, adjusting our font, color and
| | 01:00 | size, adjusting our number formatting,
adding a Background Image or changing
| | 01:05 | the Alternate Row Color of our records
and some Control Formatting options, such
| | 01:10 | as Quick Styles, changing their shape or
adjusting their fill, outline or special effects.
| | 01:16 | The rest of the form is currently just a
big empty area for us to place our objects.
| | 01:20 | It has a dot and grid pattern in the
background to help us align things together.
| | 01:24 | We can click and drag on the edges if
we need some additional space to work.
| | 01:28 | I can scroll down as well and grab the
bottom and bring it up so I can see the
| | 01:32 | bottom of my form, and I'll scroll back up.
| | 01:35 | Moving objects around in Design View
is slightly different than what you
| | 01:38 | might be used to if you've ever
worked with a layout program such as
| | 01:40 | PowerPoint or Publisher.
| | 01:42 | I'm going to go to the Controls group
on the DESIGN tab of the Ribbon and
| | 01:46 | grab this tool here with these lower case ab
and a rectangle around it, this is a text box.
| | 01:52 | The text box controls will typically
be linked to a data source such as a
| | 01:55 | field from a table.
| | 01:57 | It will be where we will type
when we want to edit a record.
| | 02:00 | Clicking the object essentially picks it up.
| | 02:03 | I like to think of these
Controls groups as a toolbox.
| | 02:05 | I've picked up the tool and my
cursor changes to reflect the objects
| | 02:09 | I'm currently holding.
| | 02:10 | I'll click once in the blank form area
to drop the object, now you'll see that
| | 02:14 | the cursor returns to the standard arrow.
| | 02:17 | When I added a text box I actually
get a text box here and a label.
| | 02:21 | The text box is the white one on the right.
| | 02:23 | This is where our data will appear.
| | 02:25 | The piece on the left, this is a label.
| | 02:27 | Labels are static text that
are informative in nature.
| | 02:30 | They stay the same when you
cycle from record to record.
| | 02:34 | Now I can move the objects around by
clicking on the orange highlighted edge.
| | 02:37 | You click here and drag, you can
see that they both come together.
| | 02:41 | In order to move the objects independently,
you'll need to use the large handle
| | 02:45 | in the upper left-hand corner.
| | 02:47 | I'll click it here on the label
and drag it on top of the text box.
| | 02:51 | Now if I try moving the text box, you'll
see that they maintain this new arrangement.
| | 02:55 | If you like to resize your objects,
just click on the handles that are on the
| | 02:59 | other edges of the bounding boxes.
| | 03:00 | For instance I'll make this text box wider.
| | 03:02 | I can click on the label and
make the label wider as well.
| | 03:06 | At any point we can switch in to Form View
using the View button up here at the top.
| | 03:11 | I'll press that and I'll go to my Working View.
| | 03:13 | Notice if you wanted to go back into
Design view you can't use the toggle
| | 03:16 | button here at the top.
| | 03:18 | But if I use the lower half of the View
button, this will give me the list where
| | 03:22 | I can switch in Design View.
| | 03:23 | Of course you can always also use these
icons down here in the bottom right to
| | 03:27 | switch into Design View here.
| | 03:29 | I'll switch back to Form View.
| | 03:31 | Notice that in Form View we also no
longer see the adjustment bounding boxes or
| | 03:36 | that dot grid that appeared in the background.
| | 03:38 | Working with the Design View of Forms
takes a little bit of practice, because it
| | 03:42 | may look a little different from
many of your other experiences.
| | 03:44 | But once you get used to some of its quirks,
you'll be assembling custom forms in no time.
| | Collapse this transcript |
| Exploring the form property sheet| 00:00 | Everything in Access has properties.
| | 00:02 | Way back when we created our table
fields, we saw that every field had
| | 00:06 | properties like field length,
caption, indexed or required.
| | 00:10 | Forms and the objects that we'll place on
to our forms all have properties as well.
| | 00:15 | In Forms however, there are so many
properties that we can modify and explore,
| | 00:19 | that they are organized into a tab
listing called the Property Sheet.
| | 00:22 | I'm going to create a new form in Design View
by going to the CREATE tab and
| | 00:26 | pressing Form Design in the Forms group.
| | 00:28 | Then on the far right of my Design tab,
I'm going to turn on the Property Sheet here.
| | 00:34 | I can resize the Property Sheet by clicking
on the edge and dragging it open, if
| | 00:38 | I'd like more space.
| | 00:39 | The Property Sheet houses everything
that you can possibly change for every
| | 00:43 | object on your form.
| | 00:44 | Right now, we're looking at the
properties for the entire form.
| | 00:48 | It says so in this dropdown list here.
| | 00:50 | I can use the dropdown to select
other objects or areas of my form.
| | 00:54 | Currently, the only two objects I have
are the form itself and the Detail section
| | 00:58 | of the form, which is this middle area here.
| | 01:01 | As we add objects to our form, this list will grow.
| | 01:05 | Below that you'll see that the
properties are split into five tabs.
| | 01:09 | The Format tab has all of our formatting
options, for instance our caption.
| | 01:13 | That's what will appear
at the tab on the top here.
| | 01:16 | We've got the Default View which is
how we are going to view our form;
| | 01:20 | we've got properties for
things like pictures, the width.
| | 01:22 | We have got color and size and font options,
all of that appears here in the Format tab.
| | 01:28 | If you want to see the additional options
you can scroll down through this list
| | 01:31 | and you can see it's pretty long.
| | 01:34 | The next tab is Data.
| | 01:36 | The Data tab is how this form connects
to its data source, where the records are
| | 01:39 | coming from and where are they going to.
| | 01:42 | We can also set properties for filtering
or how to handle additions or deletions.
| | 01:48 | The Events tab has all of the ways
that we can trigger macros or Visual
| | 01:52 | Basic routines and you can see
that there's a lot of ways that we can
| | 01:55 | trigger these events.
| | 01:56 | We can trigger an event when the font
loads for instance, or when you click on
| | 02:00 | something, or when you double-click on
something, or when the mouse clicks down
| | 02:03 | and another one when the mouse lifts up.
| | 02:06 | All of these available options we can
link to macros using the dropdown list
| | 02:09 | here to choose things from our database.
| | 02:12 | The Other tab has miscellaneous items, such as
whether this is a Pop Up form or a Modal form.
| | 02:18 | A Pop Up form will float on top of other windows.
| | 02:21 | A Modal form will force you to interact
with it before you can do anything
| | 02:25 | else in the database.
| | 02:27 | And finally, the All tab is a master list of
all of the properties from the first four tabs.
| | 02:32 | So if you don't remember which tab a
specific property was in, you can come to
| | 02:36 | the All tab and find it in this one long list.
| | 02:41 | When we're done with the Property Sheet,
we can either close it with the X button
| | 02:44 | here or toggle it off with this
button here on the Ribbon.
| | 02:48 | Some of the common properties that
you'll want to change, such as font style or
| | 02:52 | color, are also available through the
Ribbon tabs up here at the top, for
| | 02:55 | instance in this formatting
group we have Font options here.
| | 02:58 | However, the Property Sheet lists all
of the available options regardless of if
| | 03:03 | they are common, useful or obscure.
| | 03:05 | It's definitely a long list, but getting
familiar with its content can help you
| | 03:09 | identify things that you'll want
to modify in your forms.
| | Collapse this transcript |
| Setting data sources| 00:00 | In order to create a form from scratch,
the first thing we need to do is connect
| | 00:04 | it to a data source.
| | 00:05 | A form can get its data from either a
table or a query, and if you choose a
| | 00:10 | query you can either use a pre-made
query that is saved over here in the
| | 00:13 | Navigation pane, or create an embedded
query directly inside of the form.
| | 00:18 | Let's begin to create a form that we
will refine over the next few movies.
| | 00:22 | Here is the scenario: the head of the NoObstacles
training department needs a form to manage her
| | 00:27 | team's benefits and salary information.
| | 00:30 | Let's create a form that is
tailored to her specific needs.
| | 00:33 | First, we'll create a query to
gather the appropriate records.
| | 00:37 | We can do that by going to the
CREATE tab and then choose Query Design.
| | 00:41 | I'm going to add in the Employees
table and the EmployeePhone table.
| | 00:46 | I'll readjust these so I can see all
of the fields within each table, and now
| | 00:50 | I'll start choosing my fields.
| | 00:51 | I'm going to choose the FirstName and
LastName, Building, Department and Status.
| | 00:57 | We're not going to need to edit the
HireDate, but we do want the Dental, Medical
| | 01:02 | and Retirement benefits as
well as Salary and JobRating.
| | 01:07 | Finally, from the EmployeePhone table
we want the phone Number and the Type.
| | 01:12 | Now I'm going to scroll over here.
Everything went off the screen so I'm going
| | 01:15 | to make sure that I got everything including
the phone Number and Type and
| | 01:17 | those are all added, so that's good.
| | 01:20 | Now I'll scroll back here, I'm going to
add in a few criteria here to filter my list.
| | 01:24 | I'm only interested in the Employees in
the Training Department, so underneath
| | 01:29 | Criteria I'm going to type in training.
| | 01:31 | Also, I'm only interested in the phone
numbers that are the office numbers.
| | 01:35 | I don't need the home or cell number.
| | 01:37 | So underneath Type in the
Criteria row I'm going to type in office.
| | 01:44 | I also don't need to see
that this is the office number.
| | 01:47 | Because it's on the form, I'll
know it's the office number.
| | 01:49 | I can use this show check box and turn
it off which will still allow me to filter
| | 01:53 | this record, but not display it in my results.
| | 01:56 | Finally, because I want this to be a
sorted list, I'm going to go all the way
| | 02:01 | to the beginning and on the LastName I'm going
to apply a sort here, turn that to Ascending.
| | 02:07 | We can view the datasheet results by
switching to Datasheet View and we'll see
| | 02:11 | that we have 17 employees
in the Training Department.
| | 02:14 | It's sorted by LastName and if I scroll over to the
right, we've got the phone Number information here.
| | 02:22 | Okay, this is going to be the record source for
our form, let's go ahead and save this query.
| | 02:27 | I'll go up to the Quick Access toolbar
and press the Save icon and I'm going
| | 02:31 | to name this Employees-TrainingDepartment,
go ahead and say OK and I'll close the query.
| | 02:39 | Now we can start to create the form,
I'll go to the CREATE tab and in the Forms
| | 02:43 | group choose Form Design.
| | 02:45 | I'll open up the Property Sheet
for our form and go to the DATA tab.
| | 02:51 | In the DATA tab we'll find a property
called Record Source, this is where the
| | 02:54 | data is going to be coming from.
| | 02:56 | We can use the dropdown list here to
see a listing of all of the tables and
| | 03:00 | queries that are in our database.
| | 03:01 | I'll find the Employees-TrainingDepartment
query that we just built.
| | 03:07 | Go ahead and select it and
then close the Property Sheet.
| | 03:11 | Now that it's connected,
we can start adding our fields.
| | 03:13 | I'll turn on the Add Existing Fields panel
by clicking on the toggle and then
| | 03:17 | we'll see all of the fields that
are being prepared by the query.
| | 03:21 | I'll click on the FirstName and then
Shift-click on Number and now I can just
| | 03:24 | drag and drop everything at
once into the Detail section.
| | 03:28 | Now that I'm done with existing
fields I can close that panel.
| | 03:31 | Now we can start rearranging these
around on our Form into logical groupings.
| | 03:36 | I'm going to take the LastName for
instance and using the handle in the
| | 03:39 | upper left-hand corner, I'm going to drag it
and move it up here right beside FirstName.
| | 03:43 | I'm going to take Building and Department
and put them over here on the far right.
| | 03:48 | I can highlight both of these at once
and drag all of these together.
| | 03:52 | I'm going to take all of the Benefit
information, these check boxes here, I'll
| | 03:58 | highlight over those and all at once I'll drag
these over here to the right side as well.
| | 04:04 | I'll move Salary up above Status.
I'll move JobRating down below Status and
| | 04:11 | I'll take the phone number field and drag it
and put it right below the first and last name.
| | 04:17 | I'm going to open this up a little bit
to make it a little bit wider, and now I
| | 04:21 | can delete some of these
labels that are redundant.
| | 04:23 | It's going to be pretty obvious that
this is their first and last name and phone
| | 04:27 | number so I don't need any of these labels.
| | 04:30 | I'll click on the FirstName label and
press Delete on my keyboard and I'll do
| | 04:32 | the same for the other three.
| | 04:34 | At any point in time we can switch into
Form View using the toggle button up here.
| | 04:38 | Now we see what our form
looks like with data populated.
| | 04:42 | We could use the Record selectors
at the bottom to cycle through the
| | 04:45 | 17 employees in the Training Department.
| | 04:48 | If I want to go make additional changes,
I have to use the dropdown menu on the
| | 04:52 | View button to switch into Design View.
| | 04:54 | The toggle merely goes between
Layout View and Form View.
| | 04:58 | So forms that are going to be displaying
data will need to get connected to a data
| | 05:02 | source of some variety.
| | 05:04 | This form is serving a very specific task
and so we need it to gather a unique
| | 05:09 | subset of records using a query.
| | 05:11 | Once you have the query established,
it's merely a matter of connecting the
| | 05:14 | form to the query using the Record Source property
and then adding the fields over to your form.
| | 05:20 | At this point this a good place to save our form.
| | 05:22 | I'll go up to the Quick Access toolbar,
press the Save icon, and give it a name,
| | 05:27 | Training Department Employees.
Go ahead and say OK.
| | 05:33 | Now our form is saved, if I scroll down
in my Navigation pane, I can see it down
| | 05:37 | here at the bottom of the list.
| | Collapse this transcript |
| Adding components with form controls| 00:00 | Forms can have a variety of additional
objects added to them in order to help
| | 00:04 | customize their appearance and functionality.
| | 00:07 | Collectively, these additional objects
are called form controls and you can find
| | 00:12 | them in the form Design View.
| | 00:13 | Let's continue refining our
Training Department Employees form.
| | 00:17 | I'll go down and find it in the Navigation pane
and I'll right-click on it and
| | 00:21 | open a straight Design View.
| | 00:23 | On the DESIGN tab up here, we have the
Controls group with all of the things
| | 00:27 | that we can add into our form.
| | 00:29 | This is actually a scrolling list,
there's all of these controls here, but we
| | 00:33 | can also scroll down and see a
whole another row of controls here.
| | 00:36 | If you want to see everything at once,
you can use this dropdown list to view
| | 00:40 | them all on the screen at one time.
| | 00:42 | Now we're going to add a few of
these controls on to our form.
| | 00:46 | First, I am going to use this Line control here.
| | 00:49 | I'll click on it and I'll drag out a line
to mark off some space at the top.
| | 00:53 | I'll simply click and drag the line out.
| | 00:56 | When the line is perfectly horizontal,
it actually disappears completely, but
| | 01:00 | when you let go, it will show up.
| | 01:02 | So there is my first object, this line.
| | 01:05 | Let's add a Rectangle around our
Benefits to show that they all group together.
| | 01:10 | I'll use this dropdown arrow
and choose the Rectangle here.
| | 01:13 | I'll click on it and I'll drag a
box around all of our Benefits.
| | 01:17 | I can also add a label to
the top of our Benefits.
| | 01:21 | This one here, with a capital A and
the lowercase a, this is a label object;
| | 01:26 | it's not connected to data.
| | 01:28 | I'll click here and I'll
add a label called Benefits.
| | 01:33 | Once I get that put in, this little
warning flag pops up saying that it's not
| | 01:37 | actually connected to anything.
| | 01:38 | That's okay though, we can go ahead and
use this drop-down list and say Ignore Error.
| | 01:43 | Now that we've got this group labeled
as Benefits, I don't necessarily need it
| | 01:46 | to say BenefitDental,
BenefitMedical, BenefitRetirement.
| | 01:50 | I can simplify these by double-clicking
on each one and deleting the word Benefit.
| | 01:57 | Now when I double-clicked on this, it
actually toggled on the Property Sheet, so
| | 02:01 | let's go ahead and close that back out again.
| | 02:03 | I can add a logo to the top-left corner.
| | 02:06 | I can do that by using
this Insert Image button here.
| | 02:09 | I'll say Insert Image and then Browse.
| | 02:11 | Out of my Exercise folder, which is on
my Desktop>Exercise Files, in the Ch 08
| | 02:17 | folder, we'll find the NoObstaclesLogo.
| | 02:20 | I'll click that and say OK.
| | 02:22 | Now my cursor changes to a little
picture icon and I can drag out a box where I
| | 02:27 | want my image to be.
| | 02:28 | Finally, I am going to add one more label
across the top which will act as a title.
| | 02:33 | I'll click on the Label
and click again to add that.
| | 02:36 | I'm going to add a label that
says Training Department Employees.
| | 02:41 | I'll go ahead and press Enter and again
I'll dismiss this flag by saying Ignore Error.
| | 02:46 | Finally, I am going to
change the formatting of this.
| | 02:48 | I'll enlarge the box quite a bit and
I'll go to the FORMAT tab and change the
| | 02:53 | Font Size to something like 20
and I'll try a Bold font, there.
| | 02:59 | Let's go ahead and add one more control.
| | 03:02 | Back in the DESIGN group, if I use this
button here, there is an option called
| | 03:07 | Option Group, it has an XYZ at the top.
| | 03:10 | The Option Group is actually data-driven
and what I want to do is use it to
| | 03:15 | replace the job rating.
| | 03:16 | I'll click here once and I'll click down
below the JobRating field.
| | 03:20 | The Option Group will create a list of
features that we can choose from and then
| | 03:24 | translate that into a numerical field
that will save back into the JobRating.
| | 03:28 | So instead of just displaying the number
1, 2, 3, 4 or 5 for our job ratings,
| | 03:34 | we can use a radio button to select from.
| | 03:37 | My label buttons, instead of our
numbers, are going to be something a little
| | 03:40 | bit more descriptive.
| | 03:41 | For instance, I am going to type here,
Needs Improvement, I'll go down to the
| | 03:47 | next field Below Average, the next one
will be Average, the next one will say
| | 03:55 | Good and finally Outstanding.
| | 03:59 | Go ahead and press Next.
| | 04:01 | Access wants to know if we want one of
these options to be a default choice.
| | 04:05 | We can have it auto-populate or we can
choose No, I don't want a default.
| | 04:08 | I'll choose that option and say Next.
| | 04:10 | The next screen matches the labels
that we've previously selected with the
| | 04:14 | values that will get stored in the database.
| | 04:16 | These numbers are in the correct
order, so go ahead and say Next.
| | 04:19 | Finally, I can choose what
I want to do with this data.
| | 04:22 | I can either Save the value for later use
or I can store the value that we
| | 04:26 | select into a field in our database.
| | 04:28 | I'll choose to store that as our JobRating.
Go ahead and say Next and the last
| | 04:33 | screen asks us how we want it to look.
| | 04:35 | We can either have an Option button,
a Check box, Toggle buttons and we can
| | 04:40 | choose how we want the
border around the edge to look.
| | 04:43 | I am going to leave it on
Etched and Option button.
| | 04:46 | Go ahead and say Next one more time
and we get to name our Option Group.
| | 04:50 | I am going to call this JobRating.
Go ahead and say Finish.
| | 04:55 | Now we added an additional data-driven
control to our form as well.
| | 04:59 | Let's switch into Form View
to see how these work.
| | 05:01 | Now you can see that we've
got our logo here at the top.
| | 05:04 | I've got this bar separating the title
from the rest of the form, I've got a box
| | 05:08 | around our Benefits and I have this
JobRating field here that duplicates the
| | 05:13 | information that we're seeing
coming out of the data table.
| | 05:16 | If I cycle through my records, you
can see that the JobRating matches the
| | 05:19 | numerical value that's
showing up for each employee.
| | 05:22 | Now I can actually get rid of this
field because we have that information in
| | 05:26 | a more graphical way.
| | 05:27 | I'll switch back into Design View
one last time, I'll click on JobRating
| | 05:31 | here and press Delete.
| | 05:33 | Then I'll move this up into
the position that it took.
| | 05:38 | Now that our form is starting to take
shape, I'm going to go ahead and save it
| | 05:41 | up here on the Quick Access toolbar.
| | 05:44 | Adding additional controls to your form,
including boxes and lines to mark off
| | 05:47 | discreet or related areas of the form,
or images to add branding identity, can
| | 05:51 | really take your Access database
from blah to snazzy.
| | 05:55 | But beyond simple graphical appeal,
additional controls such as the Option Group
| | 05:59 | can really aid in data entry tasks as well.
| | 06:02 | You should explore some of the additional
control types to see how you can
| | 06:05 | incorporate them into your own forms.
| | Collapse this transcript |
| Understanding input boxes| 00:00 | Typing into a text box on your form
is the most common way to enter data,
| | 00:05 | but it's also the way with the least
control over what gets entered.
| | 00:07 | I am going to open up the Training Department
form that we've been working on
| | 00:11 | and you'll notice that all of these fields;
the Name, the Building, Department,
| | 00:15 | Phone Number and Salary fields
are all text boxes.
| | 00:19 | We can essentially type whatever we
want here as long as they're allowed by the
| | 00:23 | table's underlying design.
| | 00:24 | Notice that the Status field is a
combo box though, it has a dropdown
| | 00:28 | list attached to it.
| | 00:29 | That's because we've previously defined
that field in the table as a lookup field.
| | 00:34 | We can get the same effect for other
fields here in our form without going all
| | 00:37 | the way back and editing our table.
| | 00:39 | I am going to switch into Design View by
clicking on the bottom half of the View
| | 00:43 | button and choosing Design View.
| | 00:44 | I am going to click on this Building field here.
| | 00:47 | And if I right-click, you'll get a pop-up menu,
and the top option here says Change To.
| | 00:52 | We can change this text box to a Label, a
List Box or I am going to choose Combo Box.
| | 00:59 | When I change it to a Combo Box,
we see the dropdown arrow here.
| | 01:03 | Let's go back into Form View
and see how this looks.
| | 01:06 | I'll switch my view and we'll see that
we have the functionality here, but there
| | 01:10 | is nothing actually here to choose from.
| | 01:12 | So let's go back into Design View
and we'll fix that up.
| | 01:15 | Once again, I'll change my view and I'll
open up the Property Sheet for the Combo Box.
| | 01:19 | I am going to make sure that it says
Building here, this is the Combo Box.
| | 01:24 | On the Data tab, on the Control
Source, it's currently set to Building.
| | 01:28 | This is where the data is
getting saved to in my table.
| | 01:32 | The line below says Row Source.
| | 01:34 | This is where the fields that are
going to populate the list will come from.
| | 01:37 | I am going to click here and click on
the Build button on the far right to build
| | 01:42 | a query that will generate that list.
| | 01:44 | When I click Build, we put into a
new query design editing environment.
| | 01:49 | You can see on the tab up here that it says
Training Department Employees: Query Builder.
| | 01:53 | This is a query that's actually embedded
inside of the form we were working on;
| | 01:57 | it won't show up in our Navigation pane.
| | 02:00 | Here, we can pull out the Show Table window
and choose which tables we want to include.
| | 02:05 | I am going to pull in the
Employees table and say Close.
| | 02:09 | Then I am going to add the Building field.
| | 02:11 | We can look at the datasheet to see how
this looks and this is not quite the way
| | 02:16 | I want my dropdown list to look.
| | 02:17 | So go back into Design View and I'll
turn on this Totals here which will group
| | 02:21 | all of the same values together into a single entry.
| | 02:25 | Once again, let's review the datasheet and
this list is looking much better for my dropdown.
| | 02:30 | So I'll switch into Design View,
I'll close the query that will ask me if I
| | 02:36 | want to save the changes to it and I will say Yes.
| | 02:39 | That will take us back to Design View for our form.
| | 02:42 | Notice that the Row Source is now
populated with this SELECT statement.
| | 02:45 | That's the SQL code for the query we just built.
| | 02:49 | Now let's go into the Form View
and look at how it works.
| | 02:52 | I'll switch my View, go back to the Building field
here and use this drop-down list.
| | 02:58 | Now I can make a selection of all
of the buildings that are present in
| | 03:01 | my Employees table.
| | 03:03 | This list is being dynamically generated
from all of the values that appear in
| | 03:06 | our Employees table.
| | 03:08 | If a new building is added to the
Employees table, that option will
| | 03:11 | automatically appear in our Combo Box as well.
| | 03:14 | By converting this text field into a Combo Box,
we can dramatically reduce the
| | 03:18 | chances of somebody mistyping the
name of the building or adding a building
| | 03:21 | that doesn't even exist.
| | 03:23 | By leveraging these types of controls,
you can have Access help eliminate the
| | 03:27 | potential human errors that can
destroy your database's integrity.
| | Collapse this transcript |
| Recording navigation| 00:00 | Scrolling through the records on a
form using the navigation buttons on the
| | 00:04 | bottom is not a really great experience.
| | 00:06 | Let's open up the Training Department
Employees form and you'll see what I mean.
| | 00:10 | Let's try and find one of the employees
here in the Training Department, his
| | 00:13 | name is Timothy Tanner.
| | 00:15 | I'll click on the next Record button
until I find him and I will have to keep
| | 00:19 | scrolling through and there he
is on record number 12 of 17.
| | 00:25 | It's a good thing he wasn't record number
112 or we'd be clicking for quite awhile.
| | 00:29 | We can dramatically improve this
functionality by creating a specialized Combo
| | 00:33 | Box that will jump us to the record we want.
| | 00:35 | I am going to start that process
by switching my View to Design View.
| | 00:39 | First, I want to give myself some
more room on the right side of my form.
| | 00:43 | I am going to click over here and drag to
increase the background area of my form.
| | 00:47 | Next, I'll grab the Combo Box control out
of the Controls Group on the Design tab.
| | 00:52 | I'll click it once, you'll notice that
my cursor has changed now and I'll click
| | 00:56 | once to add the Combo Box to my form.
| | 00:59 | The combo box Wizard starts
up and gives me three options.
| | 01:02 | I can either choose to have the Combo
Box get values from a table or query.
| | 01:07 | I can type in a list of values that I
want to display or, and this is the one
| | 01:11 | that we're going to want, find a
record in my form based on the value that I
| | 01:16 | selected in my Combo Box.
| | 01:17 | Go ahead and choose that
third option and press Next.
| | 01:21 | Access then needs to know which
field we want to show up in the box.
| | 01:24 | I'll click on LastName and add
that over to my selected fields.
| | 01:28 | Go ahead and say Next, it shows me a
preview of what that list will look like.
| | 01:33 | Go ahead and say Next again, and now we
can give a Label to our Combo Box.
| | 01:37 | I am going to call this Search.
| | 01:40 | Go ahead and say Finish.
| | 01:41 | I am going to make my Combo Box a
little wider by dragging it here and now I'll
| | 01:46 | go back into Form View and test it out.
| | 01:49 | In my new Search box, I can use the
dropdown to show a list of all the
| | 01:54 | employees in my training department.
| | 01:55 | I can scroll through and choose Timothy
Tanner's last name to jump right to his record.
| | 02:01 | I can also use this to start typing it.
| | 02:03 | So instead, if I just type
an S, it will jump to Spencer.
| | 02:07 | If I continue typing a T,
it will jump to Strickland.
| | 02:10 | If that's the employee that I want, I
simply press Enter and you'll see that my
| | 02:14 | record updates to display that employee.
| | 02:16 | Adding a dynamic search box is a great
way to provide a quick navigation to a
| | 02:20 | specific record, without having to
know his position in the record set.
| | 02:24 | And because the list is built off
of a query, the dropdown options
| | 02:27 | automatically update whenever new
employees are added to your database.
| | 02:31 | Once it's set up, it just works and will continue
to update as your database grows.
| | Collapse this transcript |
| Adding buttons| 00:00 | Adding buttons to your forms brings
in another level of interactivity.
| | 00:04 | The Button wizard will help us attach
the act of pressing a button to a specific
| | 00:08 | action or result that we want to take place.
| | 00:10 | Let's add a few buttons to
our Training Department form.
| | 00:13 | I can open it right into Design View
by right-clicking and saying Design View.
| | 00:17 | Up on my Controls Group here, I can
choose the Button button, that's this one
| | 00:22 | here with the Xs in it.
| | 00:23 | I'll click it once to grab one and
I'll come down here into my form and I'll
| | 00:27 | click to add a button.
| | 00:29 | The Command Button Wizard starts up and
gives us lots of options for things that
| | 00:32 | we can do when we press this button.
| | 00:34 | We have a category here
called Record Navigation.
| | 00:37 | On the right is a list of
Actions that are in that category.
| | 00:39 | For instance we can find the next
record or go to the first or last record.
| | 00:45 | The Record Operations category has
things like adding records, deleting records
| | 00:50 | or printing records.
| | 00:52 | We have Form Operations here, we can
close or open a form or we can print a form.
| | 00:58 | Report Operations will email a report or
open a report or send a report to a file.
| | 01:04 | The Application category will allow
you to quit Access altogether and the
| | 01:08 | Miscellaneous category will
allow you to run macros or queries.
| | 01:11 | Let's add a few buttons onto this form.
| | 01:14 | First, I am going to go to Record Operations
and I am going to choose Add a New Record.
| | 01:19 | We'll go ahead and say Next.
| | 01:22 | Access then needs to know
how we want our button to look.
| | 01:24 | Do we want to include a Picture
on the button or do we want Text.
| | 01:28 | I like the Text option because it
allows me to be more specific about what
| | 01:32 | happens when I press the button.
| | 01:33 | So instead of just Add Record, I am
going to change this to Add Employee.
| | 01:38 | Go ahead and say Next.
| | 01:40 | We can give it a name if we'd like,
but I'll just accept the default here and
| | 01:44 | say Finish, and the button
updates here on our form.
| | 01:47 | Let's add a couple of more buttons.
| | 01:48 | I'll go back up to the controls and grab a
new button and I'll drop it into my form.
| | 01:53 | This time we're going to choose
Record Operations, Print Record.
| | 01:58 | Go ahead and say Next and the text
for this one is going to be Print
| | 02:02 | Employee's Details.
| | 02:05 | Go ahead and say Finish and
that button gets added to our form.
| | 02:08 | Let's do one more button.
| | 02:10 | I'll grab another one.
| | 02:11 | I'll click down here to add.
| | 02:13 | This time I am going to go to Form Operations
and I am going to say Close Form.
| | 02:19 | Go ahead and say Next and the text for this
button is going to say Close Data Entry Form.
| | 02:25 | Go ahead and say Next and then
Finish, that adds this button as well.
| | 02:29 | Okay, we can style our buttons a
little bit by going up to the FORMAT tab and
| | 02:33 | for instance I've got the Close Data
Entry Form button selected, I want to make
| | 02:37 | that one called out.
| | 02:38 | so I am going to go up to the Quick
Styles and change it to an orange color
| | 02:43 | here, may be this moderate Effect one,
that will make it orange and stand out.
| | 02:46 | I can also change its Shape if I'd like,
from this one to may be a square button.
| | 02:51 | If I wanted, I also have Shape Fill
options here where I can change the fill color.
| | 02:55 | I can change its Outline, Color and
down here its Thickness, I can also add
| | 02:59 | Special Effects such as Shadows
and Glows and Beveled Edges.
| | 03:03 | I am going to leave all
of those as the defaults.
| | 03:06 | Let's go ahead and move
this button down to the form.
| | 03:08 | I'll just scroll down and I'll move
this down to the bottom corner.
| | 03:11 | Then I'll scroll back up and I'll move these
buttons up towards the top and I'll line them up.
| | 03:18 | I'll go ahead and make the Add Employee
button a little bit wider so that it
| | 03:21 | matches the Print Employee's
Details button's width.
| | 03:24 | That's looking pretty good, so I am going to
go ahead and switch back into Form View here.
| | 03:28 | Now we can go through and save
our form and I'll try them out.
| | 03:32 | The Add Employee button will do the
same thing as if we have gotten all the way
| | 03:36 | down to the bottom here and
press this New (blank) record button.
| | 03:39 | If I want to add an employee,
I simply press this button.
| | 03:42 | I can print an employee's details
by pressing this button here and the
| | 03:46 | Print dialog box opens.
| | 03:47 | I'll go ahead and press Cancel.
| | 03:49 | And finally, when I'm done with the form,
I can close this data entry form right
| | 03:52 | here with a very explicit button on the form.
| | 03:55 | People love pressing buttons, they
are instantly familiar and they can be
| | 03:58 | really intuitive to use.
| | 04:00 | Using the Text option to be explicit
about what the button will do when clicked
| | 04:04 | helps users feel comfortable using your database.
| | 04:07 | The wizard gave us a few options of the
types of things that our buttons can do.
| | 04:10 | However, later when we create our own
macros, we can come back and attach those
| | 04:14 | to the buttons as well for
even more functionality options.
| | Collapse this transcript |
| Assigning tab order| 00:00 | I'll admit that I'm addicted to my keyboard.
| | 00:02 | I try and keep my hands off the mouse
as much as possible when entering data
| | 00:06 | using the Tab key to move from field to field.
| | 00:08 | However, watch what happens when we've
made as many changes to the layout of our
| | 00:12 | Training Department form as we have.
| | 00:14 | I am going to open up that Training Department
Employees form that we've been working on.
| | 00:17 | And you'll notice that the FirstName
field is currently highlighted.
| | 00:20 | I am going to press Tab to move to the
LastName field, but you'll notice that it
| | 00:24 | actually jumps all the over to building.
| | 00:26 | I'll press Tab again and it goes back to LastName.
| | 00:29 | Tab again goes to the Department and so on.
| | 00:31 | You can see that the tabs are
jumping all over the screen.
| | 00:35 | We need to take care of this problem
and we will find the tool that we need by
| | 00:39 | switching into Design View here on the ribbon.
| | 00:41 | Over on the ribbon on the far right,
you'll find a button called Tab Order,
| | 00:45 | I'll go ahead and press that and Access
lists out all of the tab stops in their position.
| | 00:51 | You'll notice that it starts with
FirstName, then goes to Building, then
| | 00:54 | LastName and then Department,
so these are all out of order.
| | 00:57 | There is a button on the bottom that
says Auto Order and when I press it, Access
| | 01:01 | will take its best guess at the right
order of things, but you can see that it
| | 01:05 | really doesn't get it right in our layout.
| | 01:07 | It goes from the Image to the Combo Box
which is our search over here on the
| | 01:11 | right, then it goes to the FirstName,
then LastName, then over to Building, then
| | 01:16 | over to the button over here to the
right of it, so we need to manually manage
| | 01:19 | these tab stops on our own.
| | 01:21 | Let's go ahead and put them in the right order.
| | 01:23 | I am going to select FirstName by
clicking on it and then I'll click and drag to
| | 01:27 | move it to the first position.
| | 01:29 | Below that will be LastName,
I'll click and drag it up.
| | 01:32 | After I get done typing in the LastName
I want to move down to the phone number,
| | 01:37 | so I'll select Number and drag that up as well.
| | 01:39 | After the Phone Number, we can go
to Building and then Department.
| | 01:44 | There is our Building, I'll move that up
and there is Department and move that one up.
| | 01:49 | After I get done with the Department, I'll
jump over here, Salary, Status then JobRating.
| | 01:54 | Salary and Status are already next to
each other, so I'll drag over both of
| | 01:58 | those to select them both and I'll drag
them up and put them below Department.
| | 02:02 | The JobRating, you'll remember,
we put in using an Option Group;
| | 02:05 | it's actually this Frame16 here
right now because we didn't rename it.
| | 02:09 | I'll click that and drag and drop it below Status.
| | 02:12 | After we get done with JobRating,
we'll move over to our Benefits;
| | 02:16 | Dental, Medical then Retirement.
| | 02:19 | Here they are here, Dental, Medical and Retirement;
| | 02:21 | I'll drag over all three and
put them below the Frame16.
| | 02:26 | Finally after that, it goes to the Image
up in the top-left, I'll drag that to
| | 02:30 | the very bottom, then the Combo Box,
which is again our Search box here and
| | 02:35 | then the three buttons, the Employee's
button, the Print details and the Close button.
| | 02:39 | Let's go ahead and say OK
to accept these changes.
| | 02:43 | Now if there are particular controls
that you don't even want to be in the Tab
| | 02:47 | rotation, you can remove them with
a property on the Property Sheet.
| | 02:50 | For instance, I don't necessarily need
the Search box to be part of that Tab Order.
| | 02:54 | I'll click on the Search box
and open up the Property Sheet.
| | 02:58 | On the Other tab of the Property Sheet,
there is a property called Tab Stop
| | 03:02 | and it's set to Yes.
| | 03:03 | I'll click on it and in the dropdown,
I'll change that to no.
| | 03:07 | Go ahead and close the Property Sheet.
| | 03:09 | We can go ahead and save our changes
and we'll switch into Form View to test it out.
| | 03:14 | Again the FirstName is highlighted and I'll press
Tab and it moves over to the LastName.
| | 03:19 | Then again, down to Phone Number, next
Tab goes over to Building then Department,
| | 03:24 | then to Salary, Status, JobRating, over
to our Benefits, then up to the buttons,
| | 03:30 | the second button here.
| | 03:32 | Tab again moves down to the Close button.
| | 03:34 | When I press Tab one more time, it'll
change the next Record, now we're on
| | 03:38 | Record 2 and it goes back
to the FirstName position.
| | 03:41 | Notice that the Search field
was not part of that rotation.
| | 03:44 | Even though, tabbing through the
fields might not be the way that you
| | 03:47 | personally would interact with the form,
it's important to consider the ways
| | 03:50 | that lots of different people work and
try and provide alternative methods that
| | 03:54 | accommodate different styles.
| | 03:56 | Making sure that your Tab Stops are in
a logical and predictable order can mean
| | 04:00 | a world of difference between a database
that is a chore to use from one that is pure joy.
| | Collapse this transcript |
| Checking out the More Forms options| 00:00 | Most data-driven forms display
only a single record at a time.
| | 00:04 | However, there are additional form
types that you can choose when you'd like to
| | 00:08 | be able to work with several records.
| | 00:10 | Up on the CREATE tab in the More Forms
group, we have two that I'd like to take
| | 00:14 | a look at; Multiple Items and Split Form.
| | 00:17 | Let's first make a Multiple Items form
based off of our EmployeePhone Crosstab
| | 00:21 | query that we created earlier.
| | 00:23 | I'll click that in the Navigation pane,
go up to More Forms and then select Multiple Items.
| | 00:29 | Access generates a Multiple Items form
that we can scroll through to see all of
| | 00:34 | our employee phone numbers.
| | 00:35 | If the Property Sheet opened,
go ahead and close it down here.
| | 00:39 | Now we can go ahead and start
making changes to your form.
| | 00:43 | Right now we're in Layout View
and I can see that by looking at the top here
| | 00:47 | where it says FORM LAYOUT TOOLS.
| | 00:48 | In Layout View I can adjust all of
the columns at once by clicking a single
| | 00:52 | representative field.
| | 00:53 | I'll quick on this FirstName cell here, David,
and click on the bottom and drag up
| | 00:57 | to make everything shorter.
| | 00:59 | Now I'll start making everything a
little bit less wide, so I can fit more
| | 01:03 | information on the screen.
| | 01:04 | I'll simply click on their cells
and drag their right edges.
| | 01:07 | We'll do the same thing for the Cell
phone number, I'll click and drag to the
| | 01:10 | right, Emergency numbers, make those
shorter, Fax, Home and the Office numbers.
| | 01:21 | Now I can also rearrange my columns by
Shift+Clicking to grab the header row as
| | 01:26 | well and then click and drag to reposition.
| | 01:29 | I am going to move Office phone to
the very beginning right after LastName,
| | 01:32 | but before Cell phone.
| | 01:34 | Notice as I am dragging I get a pink
line telling me where it's going to go.
| | 01:38 | When I let go the Office numbers
move over and everything else readjusts.
| | 01:42 | Now let's start taking a
look at some other formatting.
| | 01:45 | Access tends to put boxes around every
single field and it drives me crazy, it
| | 01:48 | makes it much more cluttered.
| | 01:50 | Let's go ahead and click on David here,
I'll Shift+Click on this last box here
| | 01:54 | to select all of my cells.
| | 01:55 | Then I'll go to the FORMAT tab, Shape
Outline then I am going to change the
| | 02:01 | Outline to Transparent
to get rid of those boxes.
| | 02:03 | I can click off to see what it looks like.
| | 02:06 | Now let's change some of the
stuff up here in the header.
| | 02:09 | First I am going to change the title,
right now it says EmployeePhone Crosstab,
| | 02:12 | which was the name of the
query we've built it off of.
| | 02:15 | I'll simply double-click to edit it and
I'll change it to Employee Phone List.
| | 02:22 | Now I'll change this graphic here,
this will be our logo for the
| | 02:25 | NoObstacles company.
| | 02:26 | I'll click on the graphic, go to DESIGN
and press this Logo button here, then
| | 02:32 | I'll browse out to my Desktop to find
my Exercise Folder and in Chapter 08 I've
| | 02:37 | got the RecycleBug logo, go ahead
and say OK and that will put it in.
| | 02:42 | But we can see that it's cropped so we
need to adjust some Properties of this image.
| | 02:47 | I'll go to my Property Sheet and in the
picture Size mode right now it's set to
| | 02:50 | Clip which is a cropping mode, I am
going to change it to Zoom so that it
| | 02:55 | shrinks to fit in the box.
| | 02:56 | Now I'll change the background color here to
match the logo, so it all blends seamlessly.
| | 03:01 | I'll click on the blue area over here
so that this portion is highlighted, and
| | 03:05 | I'll go up to the FORMAT tab, Shape Fill
and I'll change it to this white swatch here.
| | 03:11 | Finally, I want to get rid of these
boxes over here on the left side.
| | 03:14 | These are record selectors.
| | 03:15 | When you click on them essentially
you're selecting the record.
| | 03:18 | In order to get rid of those we need to
change to the Properties for the form.
| | 03:21 | If it's not selected here, you can use
the dropdown to select it from the list.
| | 03:26 | Now we're going to find the Record Selectors
property here and change it from Yes to No.
| | 03:31 | That will clean up the display quite a bit.
| | 03:33 | Let's go ahead and close the
Property Sheet and take a look and that's
| | 03:37 | looking nice and clean.
| | 03:39 | Let's go ahead and close this form and
when I am prompted I'll go ahead and save
| | 03:43 | it as Employee Phone List.
| | 03:47 | Now let's create a Split Form.
| | 03:49 | I am going to build a split
form off of my Orders table.
| | 03:52 | I'll click it in the Navigation pane, go up
to the CREATE tab, More Forms and Split Form.
| | 03:59 | A split form gives you the best of both worlds.
| | 04:02 | You get a regular form up here at the
top where you can see the details for an
| | 04:05 | individual record and then on the bottom
you get a datasheet view where you can
| | 04:08 | see that record in context
with the other records around it.
| | 04:11 | I've got a splitter bar here in the middle
here, but I can drag up if I want to
| | 04:15 | see more records at the bottom, or I can
drag down if I want to see more of the
| | 04:20 | Details section at the top,
I'll move it back here to the middle.
| | 04:23 | We can adjust some of the
properties for this as well.
| | 04:26 | This time I'm going to switch
into Design View to do that.
| | 04:29 | I'll use my View button and go to Design View.
| | 04:32 | Let's take a look at some of
the properties for this form.
| | 04:34 | I'll go to the Design tab, open up my
Property Sheet again and then right now
| | 04:39 | I am looking at the properties for the Form here.
| | 04:42 | I'll scroll down on the Property Sheet
and we'll see several properties dealing
| | 04:46 | with the Split Form.
| | 04:47 | I can see how much room I'm allocating
to the datasheet on the bottom.
| | 04:51 | I can adjust the position of the datasheet,
may be I want it on the top or
| | 04:56 | the left or right side.
| | 04:57 | I'll leave it at bottom.
| | 04:58 | And I can also turn that Splitter Bar on or off.
| | 05:01 | If I turn it off my users won't be able
to adjust the Spacing, I am going to
| | 05:04 | leave it set to Yes.
| | 05:05 | Let's go ahead and clean up the header now.
| | 05:08 | I am going to make it look like the
Employee Phone List, I am going to click
| | 05:11 | up here in the headers section and on
the FORMAT Tab we'll go to Shape Fill
| | 05:15 | and change it to white.
| | 05:17 | We'll go ahead and click on this image
here, then go to the DESIGN tab, press
| | 05:21 | the Logo button again and we'll use the
same RecycleBug logo, that way we have a
| | 05:25 | consistent brand experience.
| | 05:27 | Again, I'll change its Size mode from Clip to Zoom.
| | 05:32 | The title here is fine, I'll leave it
saying Orders, but now I want to adjust
| | 05:36 | some of these boxes here in the Details section.
| | 05:39 | I am going to click on customer.
| | 05:40 | Right now, on our table we're storing
the customer's ID number which doesn't
| | 05:43 | really aid order entry.
| | 05:45 | I would have to know the ID number for every
single customer and that's just not practical.
| | 05:49 | I can make this a better experience
by right-clicking on this text box and
| | 05:53 | converting it to a Combo Box.
| | 05:56 | Then if you remember from the Combo Box
movie, we need to go to the Data tab and
| | 06:00 | give it a Row Source so it has a
populated list when we click on the down arrow.
| | 06:04 | I'll click on the Row Source field here
and press Build to build a query
| | 06:08 | to generate that list.
| | 06:09 | I'll go to the Customer's query, I'll choose
the Customer's table and press Add and Close.
| | 06:15 | Then I'll pull in some fields from the table;
| | 06:17 | CustomerID, FirstName and LastName.
| | 06:21 | Finally, I want to sort this list by
LastName Ascending so that it's alphabetized.
| | 06:26 | I'll close the query, I'll save the changes
and that will return me back to my form.
| | 06:32 | Now there's one last change that I need
to make here, I am going to go to
| | 06:36 | the FORMAT tab, still on the Combo Box and I am
going to change Column Count here from 1 to 3.
| | 06:41 | That way it shows the ID number, the
FirstName and the LastName for my customers
| | 06:45 | when I use the dropdown list.
| | 06:46 | Let's go ahead and close the Property Sheet.
| | 06:48 | I'll go ahead and save my form here.
I am going to give it the name Orders
| | 06:53 | that's fine, go ahead and
say OK and let's test it out.
| | 06:56 | I'll switch into Form view and now I'll
press the New Record button here at the
| | 07:00 | bottom to enter a new order.
| | 07:02 | When it comes time to enter in the Customer,
I can use this dropdown list to
| | 07:06 | select the Customer, for instance
I'll choose Jasmine Tillman.
| | 07:10 | Now it puts in her ID number here
and I can continue filling in the record.
| | 07:15 | These additional form types give you even
more options when you want to review,
| | 07:19 | add or edit the records in your database,
all while unlocking the ability to
| | 07:23 | completely customize the interface
to match your needs and tastes.
| | Collapse this transcript |
| Creating a navigation form| 00:00 | You might have noticed that our Navigation pane
down on the left side of the
| | 00:04 | screen is growing at a steady rate.
| | 00:06 | Pretty soon we're going to have lots of
objects and remembering exactly which
| | 00:09 | one you need to use for a particular
task might start to become more difficult.
| | 00:13 | We can help users get around our database
and easily move from task to task by
| | 00:17 | organizing the relevant forms into a single
tabbed interface called a navigation form.
| | 00:21 | We can create a navigation form by
going to the CREATE tab in this Navigation
| | 00:26 | button here in the Forms group.
| | 00:28 | If I click on the dropdown I'll
notice I have lots of options here.
| | 00:31 | I can have tabs across the top, tabs
on the left or right side or multiple
| | 00:35 | levels of tabs across the top,
he left end top, or the right end top.
| | 00:39 | I'm going to choose the Vertical Tabs, Left.
| | 00:43 | Access creates a Navigation Form and
it gives me this drop area over here
| | 00:47 | where I can add my forms.
| | 00:48 | Let's scroll down on my
Navigation pane to choose some.
| | 00:51 | I am going to first grab the Orders form
and move it up here and drop it on Add
| | 00:56 | New, that adds the Orders Form
here into my Navigation Form.
| | 00:59 | Then we can also grab a report.
I am going to take my Products Report so we have
| | 01:05 | it for a handy reference.
I'll drag and drop it right below.
| | 01:08 | Then we can grab our Employee Phone List,
drag and drop it there, and finally our
| | 01:13 | Training Department Employees form,
I'll drag and drop it there.
| | 01:17 | Now I can go ahead and close the Navigation
pane to get it off my screen and we
| | 01:21 | can start editing the layout here.
| | 01:22 | I'm going to choose this logo and on the
DESIGN tab press the Logo button here.
| | 01:27 | We're going to choose from our Desktop
in the Exercise Files folder, in the
| | 01:33 | Chapter 08 folder, our RecycleBug logo,
go ahead and say OK.
| | 01:37 | Then I need to change its Size mode so
I'll open up the Property Sheet and go to
| | 01:41 | the Size mode for the image
and change it from Clip to Zoom.
| | 01:46 | I'll change the Background to white;
| | 01:47 | I'll click back here in the blue area
and on the FORMAT tab, Shape Fill, white.
| | 01:54 | Notice that I can also change
it in the Property Sheet here;
| | 01:56 | it's the Back Color property.
| | 01:58 | This is the code for white or I can
press the Build button here to get to
| | 02:02 | the same color chips.
| | 02:03 | I can also change the styling of my buttons.
| | 02:06 | I'll press the Orders button here
and then change to the FORMAT tab.
| | 02:09 | Under Quick Styles, I can choose a Color Style.
| | 02:12 | I'm going to choose this green option here,
the Subtle Effect, Green Accent 6.
| | 02:16 | I can also change its shape if I'd like.
We can make it a rounded rectangle.
| | 02:20 | I'll do the same for the other buttons here.
| | 02:22 | I'll change the Quick Style to green
and this shape to this rounded rectangle.
| | 02:26 | I can select multiple buttons by holding down
the Shift key and selecting all of them at once.
| | 02:32 | Then I can go to Quick Styles and change
them all of it at one time, just like that.
| | 02:38 | Finally, I am going to change
the name up here at the top;
| | 02:41 | right now it says Navigation Form.
| | 02:43 | I am going to double-click on that
and say No Obstacles Database.
| | 02:46 | All right, we can go ahead and save
our form, I'll press Save up here.
| | 02:52 | Go ahead and name it Navigation Form
and say OK and I'll close the Property
| | 02:56 | Sheet and switch my View on the
HOME tab, switch to Form View.
| | 03:00 | Now I can click through these buttons
and move to my database.
| | 03:04 | First I can click Orders to get to my
Orders Form, then I can click Products
| | 03:08 | which will give me the Products Report,
which I can scroll through and see all
| | 03:12 | my products in the company, the Employee
Phone List will bring up my multiple
| | 03:16 | items form and I can scroll through
that to see all of my employees.
| | 03:19 | Or I could press Training Department
Employees to affect some of their settings.
| | 03:23 | The Navigation Form allows you to link,
form and report objects, it might
| | 03:27 | even eliminate the need for you to go to the
Navigation pane to get around your database.
| | 03:32 | This will help you accomplish your day-to-day
management operations, quicker and easier.
| | Collapse this transcript |
|
|
9. Creating ReportsIntroducing reports| 00:00 | Reports prepare your data for printed output.
| | 00:03 | They gather input records from tables
and queries and then add formatting and
| | 00:07 | page layout capabilities in order to
organize the data and make it more legible.
| | 00:12 | As you can see on the CREATE tab up here,
there are lots of different ways that
| | 00:16 | we can create a report.
| | 00:18 | They share many of the same design
principles that we have already seen when
| | 00:21 | creating forms, including the same
use of control objects and very similar
| | 00:24 | design and layout views.
| | 00:26 | Easiest way to get started creating a
basic report is to use the one-click
| | 00:30 | Report button here on the CREATE tab.
| | 00:33 | First, click on the table or query
that you want to build the report off of.
| | 00:37 | I am going to choose the EmployeePhoneNumbers
query that we constructed earlier
| | 00:40 | on the course and then, go up here to
the ribbon and press the Report button.
| | 00:44 | Access generates a basic report for our data.
| | 00:47 | Just like with forms, we can use the
Layout View that we are in now to all alter
| | 00:51 | the spacing and positioning of the report's fields.
| | 00:53 | The dashed line around the border
here indicates the extent of my page
| | 00:57 | margins and you can see that we have
some fields that are spilling over onto
| | 01:00 | the adjacent pages.
| | 01:01 | We can fix that by adjusting these widths.
| | 01:04 | I'll click here where it says Zachary,
which is our first employee.
| | 01:07 | That will select the entire column.
| | 01:09 | Now I can adjust the width
of the entire column here.
| | 01:11 | I'll do the same thing with the
LastName and the Phone Number.
| | 01:18 | Just like with forms, Access likes
to surround every field here in our
| | 01:21 | reports with a box.
| | 01:22 | I find this to be distracting.
| | 01:24 | So we can go ahead and remove
these boxes by selecting each column.
| | 01:27 | I'll go ahead and select this Office and I'll
Shift+click here to select all of the columns.
| | 01:31 | I'll go up to the FORMAT tab and in
Shape Outline I'll change it to Transparent.
| | 01:37 | Now we can take a look at what this
form looks like in a printed page by
| | 01:40 | switching to the HOME tab and going to
the bottom half of the View button here
| | 01:44 | to switch into Print Preview mode.
| | 01:46 | That will give us what the form will
look like, set up on the printed page.
| | 01:50 | I can click the zoom out
button to see the entire view.
| | 01:54 | Then when we are done with Print Preview,
we can press this Close Print Preview
| | 01:57 | button here to return to our editing mode.
| | 02:00 | So that's what Access created for us
without asking for any input.
| | 02:03 | One area, that I think could use some
improvement with our phone number
| | 02:06 | report is that the fact that each of our
employees is listed over and over
| | 02:09 | for each phone number.
| | 02:11 | We can clean that up a bit with just a few
more steps by using the report wizard instead.
| | Collapse this transcript |
| Using the Report Wizard| 00:00 | We can get more control over the
layout of our report by allowing the Report
| | 00:04 | Wizard to walk us through the process
of collecting and organizing our data.
| | 00:08 | Let's create another employee
phone number report using the wizard.
| | 00:11 | I am going to go up to the CREATE
tab and go to Report Wizard here.
| | 00:17 | The Report Wizard starts and I get
to choose the source of my data.
| | 00:20 | In the dropdown notice that you can
choose from any of your tables or, scrolling
| | 00:24 | down, any of your queries.
| | 00:25 | I am going to use the EmployeePhoneNumber
query that we created earlier.
| | 00:29 | Now we can add the available fields to
our selected fields to use in the report.
| | 00:33 | The order here is important though, so
make sure you choose LastName and move
| | 00:37 | that over and then FirstName, move that over
then, Number and then Type. Go and say, Next.
| | 00:45 | Access has identified the relationship
between our names and phone numbers and
| | 00:49 | suggests that this is a layout where we
group our last names together and then our
| | 00:53 | phone numbers will appear under that.
| | 00:55 | The other option here, by EmployeePhone, will
list them with each phone number on its own line.
| | 00:59 | I am going to choose by Employees.
| | 01:02 | Go ahead and say Next.
| | 01:03 | We can add additional groupings here if
we'd like, but we don't need to do that,
| | 01:06 | so go ahead and say Next.
| | 01:08 | Next, we are going to sort our numbers
based off of their type, so they stay
| | 01:12 | in a consistent order.
| | 01:14 | Go ahead and say Next.
| | 01:16 | We have some options here
for how our report will lay out.
| | 01:18 | I can choose either of the Stepped,
Block, or Outline format and you see a sort
| | 01:23 | of preview here on the left.
| | 01:24 | I am going to choose Stepped.
| | 01:26 | We can choose our Paper Orientation
as either Portrait or Landscape.
| | 01:29 | I am going to leave it as Portrait.
| | 01:31 | And finally, we have a checkbox here to
adjust the field width so that all the
| | 01:35 | fields fit on a page.
| | 01:36 | I am going to go ahead and leave that on.
| | 01:39 | Go ahead and say Next.
| | 01:40 | We can give our Report a title.
| | 01:42 | I am going to call it Employee Phone List
and finally, we get to choose whether
| | 01:46 | we want to preview the
report or modify the design.
| | 01:49 | I'll leave it on Preview and say Finish
and that will take us into Print Preview
| | 01:53 | view with our report.
| | 01:55 | Even though this is the same data as
the report that we used in the previous
| | 01:59 | movie, the report has a very different look.
| | 02:01 | Now each employee is only listed a
single time and their phone numbers are
| | 02:04 | listed multiple times below that.
| | 02:07 | Now we have a different problem though.
| | 02:09 | The alternating row color that Access
puts in here, is making it a little
| | 02:12 | difficult to distinguish each section.
| | 02:14 | Let's continue refining the layout
here, using the Layout tools.
| | 02:17 | I am going to close the Print Preview
with this button here on the ribbon.
| | 02:21 | That will switch me into Design View.
| | 02:23 | Using the View button here, I'll change
it back to Layout View and if it's open,
| | 02:28 | I am going to close the Field List
to give myself some more room.
| | 02:31 | Now we need to remove
the alternating row colors.
| | 02:34 | I'll click on this first one here and
on the FORMAT tab, Alternating Row Color,
| | 02:39 | I am going to change that to No Color.
| | 02:41 | There is also an Alternating
Row Color on our names.
| | 02:44 | So I'll click one that's active, Alternate
Row Color and again No Color.
| | 02:49 | Now I can change it to a standardized
color for our names, so that every
| | 02:53 | single name has a different color bar,
that'll help separate the different
| | 02:56 | sections of our report.
| | 02:57 | Instead of an Alternate Row Color, I am
going to go up to Shape Fill and choose
| | 03:02 | this light green color here.
| | 03:05 | Now I can see that there is white
background between my names.
| | 03:08 | I'll click on the last name here, Shift+click
on the first one and change their
| | 03:12 | background color to the same green.
| | 03:14 | Finally, I can make our fonts bold
here and I want to give them a little
| | 03:19 | bit more space above.
| | 03:20 | So what I can do is drag down to increase
the width of the bar and then go up
| | 03:25 | to the top edge and when I get this
double-headed arrow, I'll drag down to
| | 03:28 | reposition that towards the bottom, so that I have
a larger bar separating each employee's name.
| | 03:33 | Now that our employees are taken
care of, let's go ahead and finalize our
| | 03:36 | report by adjusting some of the
options up here in the header.
| | 03:39 | First I am going to click on this
Employee Phone List and I am going to move it
| | 03:44 | over using my arrow keys.
| | 03:45 | That will give me room now to put in a logo.
| | 03:48 | On the DESIGN tab, I'll press the Logo button
here then I'll browse out to
| | 03:51 | my Desktop and into my Exercise folder,
we are in Chapter 9 and I am going
| | 03:55 | to choose the RecycleBug logo, go ahead and
say OK and Access puts that in the background.
| | 04:00 | Now I'll change the background color
of my header by clicking over here
| | 04:03 | to select the header.
| | 04:04 | I'll go to FORMAT>Shape Fill and choose White.
| | 04:09 | Then I'll change the color of this bar
here to a darker green, Shape Fill and I
| | 04:14 | am going to choose this dark green down here.
| | 04:16 | And finally, I am going to change the
color of the labels by selecting each one
| | 04:20 | by Shift+clicking and changing their
font color here to white, I'll make them
| | 04:25 | bold so they stand out more and
then, I'll adjust the names here by
| | 04:28 | double-clicking and putting
in some spaces. Great!
| | 04:33 | So that's looking pretty good.
| | 04:34 | Let's go ahead and see what this
looks like on the printed page.
| | 04:36 | I'll go back to the DESIGN tab here
and switch my View to Print Preview. Now I
| | 04:42 | can see what this looks like.
| | 04:44 | I can zoom out to see the whole page,
zoom in, scroll up and down to take a look
| | 04:48 | and when I am done, I can close Print Preview.
| | 04:50 | Let's go ahead and save the changes
here and then I'll save it down in our
| | 04:54 | Navigation pane, here.
| | 04:55 | The Report Wizard was able to get us a
little closer to report that is formatted
| | 04:59 | in the way that we would like.
| | 05:00 | With a little additional help tweaking
the results in Layout View, we were able
| | 05:04 | to arrive at a neatly formatted phone list
that could be printed out and
| | 05:07 | distributed to our employees.
| | Collapse this transcript |
| Creating a report in Design view| 00:00 | For complete control over your report
layout, you're going to want to explore
| | 00:04 | the Report Design View.
| | 00:05 | Many of the features that we went over
with form design also apply to the
| | 00:09 | design of reports, which make it
easy to apply what we already know.
| | 00:12 | However, reports have a structure that
is distinct from most forms which adds
| | 00:16 | another aspect to their construction.
| | 00:19 | Most forms display only a
single record at a time.
| | 00:22 | Reports display many records, one after another.
| | 00:25 | Let's open up that Employee Phone Number
report and I am going to open that in
| | 00:29 | Design View by right-clicking on it
and going straight to Design View.
| | 00:32 | Now you might be surprised at how short this is.
| | 00:35 | The nature of a report is that there
are several sections but they get stacked
| | 00:38 | one on top of another over and over again.
| | 00:41 | We only have to design each piece of
the stack one time and Access just repeats
| | 00:45 | it as many times as it needs.
| | 00:46 | At the top of our report, we have the Report
Header section, that's this area right here.
| | 00:51 | The report header will only appear at the
very top of the very first page in the report.
| | 00:56 | After that, we have a Page Header.
| | 00:58 | The Page Header section will
appear at the top of every page.
| | 01:01 | Then we have the LastName Header.
| | 01:04 | The LastName Header appears every time
we have a new employee for our report.
| | 01:07 | Below the LastName, we
have got this Detail section.
| | 01:11 | The Detail is the meat of our report.
| | 01:13 | It's where all of our phone
numbers are going to appear.
| | 01:15 | If an employee has three phone numbers,
we'll get three detail sections
| | 01:19 | stacked on top of each other before going to
the next employee which will have a new header.
| | 01:24 | Then we'll have phone numbers
over and over again for that employee.
| | 01:27 | Once we get to the bottom of the page,
we get a Report Footer section.
| | 01:31 | The Report Footer section is here and
currently has calculated boxes that will
| | 01:35 | give us the date stamp and the number of pages.
| | 01:38 | Then we go to the top of the very next page.
| | 01:40 | That gives us a new page header, then
a name header for our employee, phone
| | 01:44 | number, phone number, phone number in the
Detail section, the next header for the
| | 01:48 | next employee, more phone numbers and so on.
| | 01:50 | When we run out of phone numbers,
we get this Report Footer section.
| | 01:54 | Our report doesn't currently have a footer.
| | 01:56 | But if it did, it would appear at the
very bottom of the very last page.
| | 02:00 | Let's make some adjustments to our report now.
| | 02:02 | I'm going to take our Detail section
and right above where it says Page Footer,
| | 02:06 | I am going to get this double-headed arrow.
| | 02:08 | I'll click and drag it down just a little bit here.
| | 02:11 | Now let's see how that affects our report.
| | 02:13 | I'll switch my view into Print Preview mode
and you can see that we get a gap
| | 02:18 | below every single phone number and
since that repeats over and over and over
| | 02:21 | again, that can dramatically increase
the spacing and layout of our report.
| | 02:25 | Typically you are going to want to
keep your report design as compact as
| | 02:28 | possible so that your data
rows follow one after another.
| | 02:31 | Let's go back and close Print Preview,
that will take us back to Design View.
| | 02:36 | The typical workflow when working in
Design View is going to have you open up
| | 02:40 | some space here in a Detail section
for example and the move fields around.
| | 02:45 | Then when you get everything organized,
the way you want it, you will go back and
| | 02:48 | collapse everything down as tight as possible.
| | 02:50 | I am going to add a line here
that will separate our phone numbers.
| | 02:53 | In order to do that, I am going
to work in this Detail section.
| | 02:57 | I am going to highlight this Type and
Number field and using the arrow keys, I
| | 03:01 | am going to move them down to give me some room.
| | 03:04 | Then I'll deselect them by clicking over in the edge.
| | 03:06 | I am going to go up to the Controls group
up here and I'll scroll to the list
| | 03:11 | until I find the Line here.
| | 03:12 | I am going to click on my form
and I am going to drag out a straight line,
| | 03:17 | starting at the left side and going
all the way over here to the right.
| | 03:20 | When your line is perfectly horizontal,
it actually looks like it disappears.
| | 03:23 | If it does then, go ahead and let go of
the mouse and you have got a perfectly
| | 03:28 | straight line all the way across.
| | 03:29 | Now let's go ahead and change the color of it.
| | 03:32 | I'll go to the FORMAT tab and under
Shape Outline I am going to choose this
| | 03:36 | medium green color over here on the right.
| | 03:38 | Now I am going to move it up,
so it's tight against this detail section.
| | 03:42 | I'll press the up arrow key a couple of
times until it's all the way at the top.
| | 03:46 | If I press it too many times,
it'll jump up into the LastName Header.
| | 03:50 | I can see it's highlighted right up here.
| | 03:52 | I'll press down one time to
move it to the other section.
| | 03:55 | Now I am going to highlight Type and
Number again and I am going to use my up
| | 03:59 | arrow keys to move them all the way up to the top.
| | 04:02 | Once I have got those tight against the edge,
I am going to grab the bottom of
| | 04:06 | the Detail section here and drag that
up again to sandwich it all together.
| | 04:10 | Now let's go ahead and change our view again.
| | 04:12 | Go to DESIGN, go to View and go to Print Preview.
| | 04:15 | Now you can see we have a line separating
every single one of our numbers.
| | 04:19 | Let's go ahead and close the Print Preview
to return to the Design view.
| | 04:22 | So other than the structural difference,
the design of report is almost identical
| | 04:25 | to the design of forms.
| | 04:27 | You have the same tabs going across the top,
you have the DESIGN tab with our
| | 04:31 | controls in it, our header and footer
options are here, we can add existing
| | 04:34 | fields from our record set or we can
open the Property Sheet to explore the
| | 04:38 | properties for every single option
just like in Forms.
| | 04:40 | On the ARRANGE tab, over here on the
right side, we have our options for
| | 04:44 | arranging our items, for aligning them
to each other or for bringing them down
| | 04:47 | in front of each other or sending them
behind each other.
| | 04:50 | On the FORMAT tab, that's where I am
going to go to adjust colors and fonts
| | 04:54 | or set images here.
| | 04:56 | Unlike Forms we have a new tab
here called PAGE SETUP.
| | 04:59 | The PAGE SETUP tab has options for
setting our page size and adjusting the
| | 05:02 | orientation of our paper.
| | 05:04 | So overall, building reports is nearly
identical to constructing forms, we'll use
| | 05:08 | the same tools and techniques
that we've already been practicing.
| | 05:11 | Keep in mind the stack nature of the
report structure with the repeating
| | 05:15 | sections and you'll be well on your way to creating
some very attractive and well-organized reports.
| | Collapse this transcript |
| Grouping and sorting records| 00:00 | Understanding the grouping and sorting
options available when setting up your
| | 00:04 | reports, will allow you to have complete control
over the organization, layout
| | 00:08 | and styling of the data;
| | 00:10 | doing this in layout view will allow you
to experiment with the grouping and
| | 00:13 | sorting of your records into logical arrangements.
| | 00:15 | We are going to create a new report
that takes a look at the total number of
| | 00:18 | products that NoObstacles has sold.
| | 00:20 | We'll start by taking a look at this query
that I set up called Products Sold.
| | 00:24 | I'll double-click on it to run it
and you will see that we are pulling
| | 00:28 | information about the department
and category of each of our products.
| | 00:31 | Then we are calculating the total number sold
and the overall value that they
| | 00:34 | have contributed to our bottom line.
| | 00:36 | By switching to Design View, we'll see
that this is a Totals query and in this
| | 00:40 | fourth column, I have got the Total
Quantity Sold and this one over here I have
| | 00:44 | got the Total Value.
| | 00:46 | Let's go-ahead and close this query
and we'll start our report.
| | 00:49 | I am going to make sure that I have
got the query still selected here in the
| | 00:53 | navigation pane and I am going to go
up to CREATE and I am going to press
| | 00:55 | the Report button here.
| | 00:58 | That will generate a basic
report and set us up in Layout View.
| | 01:01 | Let's go ahead and adjust these sizes
so that we are not running off the page.
| | 01:04 | I'll take my Department field and
shrink it down and we'll do the same thing
| | 01:06 | with Category, shrink it down.
| | 01:10 | Now everything is fitting onto a single page.
| | 01:12 | I am actually going to give some
more room to Product, because some of my
| | 01:14 | product names are quite long.
| | 01:17 | I'll adjust that out a little bit more.
| | 01:20 | Right now, I am seeing a single line for
every record that's being fed from the query.
| | 01:24 | If I go up to my ribbon here we
have got some options on the DESIGN tab
| | 01:27 | called Group & Sort.
| | 01:29 | If I turn that on, that will add this
new window down to the bottom where I can
| | 01:31 | start grouping these records together.
| | 01:33 | I am going to press Add a group and I
am going to choose to group them based
| | 01:37 | off of their category.
| | 01:39 | Now my records are sorted by category.
| | 01:40 | I have got the Furniture category and
then all of the departments under that and
| | 01:43 | if I scroll down through my report,
we'll see the home category here and then,
| | 01:50 | all the departments under that.
| | 01:51 | I'll go ahead and scroll back up.
| | 01:53 | I can add additional groups down below that.
| | 01:55 | I'll go ahead and add a new group here
and this time I'll group on Department.
| | 01:59 | Now I have got the Furniture category
and the Bedroom department, and then all
| | 02:03 | of the products that fall in to that department.
| | 02:05 | Then I have got the dining department, still
in the Furniture category and those products.
| | 02:10 | I can scroll down to see all of the
products and category groupings that we have.
| | 02:15 | When I get to a new category, Home,
the Home category has a bath, dining and
| | 02:20 | entryways departments.
| | 02:23 | Let's go ahead and scroll back up.
| | 02:25 | Now underneath that, we can add sorting options.
| | 02:28 | I can sort based off of the alphabetized
product name or I can start to sort
| | 02:32 | them based off of these values over here,
the total numbers sold and the
| | 02:35 | total dollar value.
| | 02:36 | Maybe I want to see the popularity
of some of my products;
| | 02:39 | I am going to sort them by Total Sold.
| | 02:42 | I'll add a sort and let's start by Total Sold.
| | 02:46 | Now I can see that this is
going from smallest to largest.
| | 02:49 | I want to reverse that so that
my most products is at the top.
| | 02:52 | We'll sort it from largest to smallest, there.
| | 02:55 | If I wanted to see it by overall dollar values,
instead of popularity, I can
| | 02:59 | sort it by Total Sold Dollars instead, here.
| | 03:02 | Now it's sorting by dollar value and my most
profitable products jump to the top of those list.
| | 03:07 | I can also experiment with the ordering.
| | 03:09 | Right now, we're looking at the categories
and in the departments within each
| | 03:12 | category, if I click on Department here,
I can reorder these by pressing this up
| | 03:17 | button here to move it to department up.
| | 03:20 | Now I am grouping on Department first
and looking at the Category second.
| | 03:23 | So now my Departments are my home areas,
my Bath department for instance and
| | 03:28 | below that I have got the Home and
Textiles, then I have got my Bedroom
| | 03:33 | department and then in the Bedroom
I have got Furniture and Textiles.
| | 03:36 | So I have got a different
organization to my records.
| | 03:39 | Let's go ahead and save this report.
| | 03:41 | I'll try and close it here.
| | 03:43 | Access will tell me to save it and
I'll say Yes and I'm going to call this
| | 03:47 | Products Sold, that I'll append by Department,
didn't know that they are sorted
| | 03:52 | currently by the department.
| | 03:54 | Setting up grouping and sorting
options allows you to experiment with the
| | 03:57 | presentation of your data, adding
appropriate sorting to your data will
| | 04:00 | bring the most important insights to the top
of the list, so that they don't get overlooked.
| | Collapse this transcript |
| Creating calculated totals| 00:00 | So far our products sold by
Department Report has organized and grouped the
| | 00:04 | records that were gathered
by our products sold query.
| | 00:07 | We can also add some statistical information
about each group right inside of the report.
| | 00:11 | This will give you some quick grand
total figures that can help in understanding
| | 00:15 | the data and making
comparisons across departments.
| | 00:17 | I am going to double-click on the
Products Sold by Department report in order to
| | 00:21 | open it up and take a look at where we are at.
| | 00:24 | Right now our products are sorted
by Department and then Category.
| | 00:27 | Let's switch our view into Layout to add
some summary statistics about each category.
| | 00:31 | I am going to click on this Total
Sold here and go up to the ribbon.
| | 00:35 | Now if your Group & Sort window is
still open from the previous movie, you can
| | 00:39 | go ahead and close it.
| | 00:40 | Then I am going to press Totals and Sum.
| | 00:42 | That will add a new row down here
that will sum up the total dollar value
| | 00:47 | within this category.
| | 00:48 | As I scroll down, I have got another
category down here, the Textiles category
| | 00:54 | and there is a sum total for that category.
| | 00:57 | Then I have a sum total for
the entire Department here.
| | 01:02 | Now these might be a little bit small
so we can go ahead and adjust their size
| | 01:05 | by dragging them open a little bit more
and I'll drag this one as well, to make
| | 01:10 | them bigger so that there is
more room to display that data.
| | 01:13 | Now we'll do the same thing
for this Total Number Sold.
| | 01:16 | I'll click on one of the values,
go up to Totals and say Sum.
| | 01:19 | That will add the Sum total of the total
number of products within this category.
| | 01:24 | Let's do one more.
| | 01:25 | I'll click on one of the
products, go up to Totals.
| | 01:28 | Now notice that since this isn't a
numerical value, I can't add them together or
| | 01:32 | find their average for instance.
| | 01:33 | But I can count how many there are.
| | 01:35 | I'll choose Count Records, that will
add a count of how many records we have
| | 01:40 | within this category.
| | 01:41 | Now at any time, we can go back
to Group & Sort and rearrange our
| | 01:44 | Departments and Categories.
| | 01:45 | For instance, if I don't need this
granular level of detail, I can get rid of
| | 01:49 | the category and just take a look at
everything by department, to find the
| | 01:52 | overall in the entire department.
| | 01:54 | Let's go ahead and click on Category.
| | 01:57 | I'll press the Close button over
here to get rid of the Category group.
| | 02:00 | Access will tell me that we are about
to delete some calculated fields, but
| | 02:04 | that's okay, go ahead and say Yes.
| | 02:06 | Now our report is just sorting by the
Department and I can see within this Bath
| | 02:10 | department that our Bamboo Shower
Curtain is by far our most profitable product.
| | 02:16 | Let's make one more change here and
then we'll take a look at what this report
| | 02:19 | is looking like in Print Preview.
| | 02:20 | I'm going to turn off our Group &
Sort now and I am going to get rid of
| | 02:25 | all these boxes again.
| | 02:26 | I'll select in this box right up here
and if you don't see it, go ahead and just
| | 02:30 | select one of the fields
and that should show up.
| | 02:33 | Click on that box to select all
of the cells within that report.
| | 02:36 | And I am going to go to the FORMAT tab,
Shape Outline and say Transparent to get
| | 02:40 | rid of all the boxes around each cell.
| | 02:42 | Then I'll go to the DESIGN tab
and change my View to Print Preview.
| | 02:46 | Now I can see that the Print Preview of
my report, I have got the total number
| | 02:50 | of products within each department, I
have got the total number of sold in each
| | 02:54 | department, and I have got the
total dollar value for each department.
| | 02:57 | Now you might notice that these
numbers aren't formatted as dollar values.
| | 03:00 | We can fix that up in layout view.
| | 03:02 | I'll close Print Preview, click on one
of those cells and go to the FORMAT tab
| | 03:06 | and change it to a dollar value,
there we go, that looks better.
| | 03:09 | So there is our finished products sold report.
| | 03:11 | I am going to go ahead and save it by
pressing the Save icon on the Quick Access toolbar.
| | 03:16 | By grouping the records together and
calculating summary statistics across the
| | 03:18 | groups, you enhance the value of the
report by providing additional aggregation
| | 03:22 | information at each change
in category or department.
| | 03:25 | This allows you to more easily compare
data across departments and get a bigger
| | 03:29 | picture of what's going on in the organization.
| | Collapse this transcript |
| Applying conditional formatting rules| 00:00 | Conditional formatting rules will call
attention to specific values that you
| | 00:04 | would like to highlight in your report.
| | 00:06 | Let's create a new report to analyze the
No Obstacles company's customer spend levels.
| | 00:10 | I have created a new query here, called Customer Spend
and if I double-click on it to
| | 00:15 | run it, we'll see those records.
| | 00:16 | We have go the FirstName and LastName
of our customers, the Region and State
| | 00:20 | that they are from and then overall
spend level that they have contributed to
| | 00:23 | the company's bottom line.
| | 00:24 | By switching to the Design View we
can see how that was constructed.
| | 00:27 | We have got four tables;
| | 00:29 | Customers, Orders, States and Products.
| | 00:31 | This is a totals query and down here
this is how I am calculating the TotalSpend.
| | 00:35 | I am taking the price of each product,
multiplying it by the quantity that
| | 00:39 | each person has ordered and then I am adding
that up across all of the orders for each customer.
| | 00:44 | Let's close this out and we'll
create a report based off of this data.
| | 00:47 | I'll go up to the CREATE tab and press
the Report button, make sure that the
| | 00:51 | query is still highlighted in the Navigation pane.
| | 00:53 | Press Report to get a basic report.
| | 00:55 | Now I am going to go ahead and adjust
these field widths to shrink everything
| | 00:59 | down on to one page.
| | 01:00 | I'll make sure that this FirstName is
highlighted and I'll reduce its Width and
| | 01:04 | we'll do the same thing with some of
these others, LastName, Region and State.
| | 01:11 | Next, I am going to add an additional
TotalSpend column here to the right side
| | 01:15 | and I'll show you why I am
going to do this in just a moment.
| | 01:19 | But for now press, Add Existing Fields,
that will show us all the fields from
| | 01:23 | our query and I'll take total spend and
I'll double-click on it again, to add a
| | 01:27 | second duplicate column here.
| | 01:28 | Now I can close my field list.
| | 01:30 | Now let's say we want to
highlight our top customers.
| | 01:32 | I am going to click on this first TotalSpend
column here and go up to the FORMAT
| | 01:36 | tab and choose Conditional Formatting.
| | 01:38 | Here we can create a new rule for
how these values will be formatted.
| | 01:41 | I am going to say New Rule, I am going
to choose the Field Value is, here in the
| | 01:47 | next box, we can choose how
want to specify the value.
| | 01:50 | We can specify a range between or not between.
| | 01:54 | We can say equal to a specific value
or not equal to a specific value.
| | 01:57 | I can choose more than or less than a
value or I can say greater than or equal
| | 02:02 | to or less than or equal to.
| | 02:04 | I am going to say greater than or equal to
and in the next box over, I'll type 10,000.
| | 02:08 | This will highlight all of our customers that
have spent more than $10,000 with the company.
| | 02:13 | We can adjust the formatting down here.
| | 02:14 | I am going to change it to a bold font
and I'll change the background color to
| | 02:19 | this green color right here, Green 2.
| | 02:21 | We'll get a preview of what
that looks like over here.
| | 02:24 | Go ahead and say OK and press Apply.
| | 02:27 | And back here in our report, you will see
that some of our values got highlighted.
| | 02:31 | Let's go ahead and say OK.
| | 02:32 | Now let's create a second conditional
format for this second column.
| | 02:36 | I'll click over here in this TotalSpend
value, go up to Conditional Formatting
| | 02:40 | and I'll say New Rule.
| | 02:42 | This time I am going to choose
Compare to other records.
| | 02:45 | This will create a data bar whose width
is determined by their overall spent.
| | 02:49 | I am going to choose Show Bar only, that
will remove the number from this field.
| | 02:53 | I can choose a Bar color down here.
| | 02:55 | I am going to choose this dark green color here.
| | 02:58 | Here we'll determine how our lowest values
and our highest values will be determined.
| | 03:02 | We can either use the absolute values
that appear in our data or we can specify
| | 03:06 | our own low value and high value
or low percent and high percent.
| | 03:12 | I am going to leave it set to
Lowest value and Highest value.
| | 03:15 | Let's go ahead and say OK and then Apply,
then we'll press OK to close the
| | 03:20 | Conditional Formatting Rules Manager.
| | 03:22 | You can see the data bars appear
here in the background.
| | 03:25 | In Access, the Data bars fade from
the color we selected out to white.
| | 03:28 | I find that this makes them a little
bit difficult to read, but if we add a
| | 03:32 | color in the background, for instance
I'll go up to Shape Fill and choose this
| | 03:35 | Dark Gray color right here, we get a
better distinction of where that data bar
| | 03:40 | ends and I can scroll through my values
and see who's contributed the most and
| | 03:44 | who's contributed the least.
| | 03:46 | Now let's do one more conditional formatting.
| | 03:48 | Here we have highlighted the cell where
our customer spent more than $10,000.
| | 03:53 | What if we wanted to highlight
the entire row of that customer?
| | 03:55 | Well, we can do that too.
| | 03:57 | Let's go ahead and select these rows here,
I'll start with the State, then I'll
| | 04:00 | Shift+click on one of the customers' names.
| | 04:03 | That will select all four columns.
| | 04:04 | I'll go back up to Conditional Formatting.
| | 04:07 | I'll say New Rule, and this time instead
of choosing Field Value is here, I am
| | 04:13 | going to choose Expression is.
| | 04:15 | That will allow me to type in a formula.
| | 04:17 | For the formula I am going to make reference
to the original field which is TotalSpend.
| | 04:22 | I'll do that with a square bracket,
type TotalSpend with no space, closing
| | 04:27 | square bracket and then we'll put in
the same value, greater than 10,000.
| | 04:32 | I'll set my conditional formatting to
the same bold and the same green color.
| | 04:38 | We'll say OK and then Apply and you
will see that the entire row now gets the
| | 04:44 | same formatting all the way across.
| | 04:46 | Now let's get rid of those lines.
| | 04:48 | I'll select all the cells here, go to
Shape Outline and say Transparent and now
| | 04:54 | we can scroll back up to the top,
switch to the HOME tab and we'll take a look
| | 04:59 | at it in Print Preview mode.
| | 05:00 | Now we have got some conditional formatting
rules that have been applied to our data.
| | 05:04 | Whether you're looking to add impact
or clarity, conditional formatting
| | 05:06 | rules are easily applied to numerical
data fields that you want to call
| | 05:10 | special attention to.
| | 05:11 | You can reference their value or
using the expression, you can apply the
| | 05:15 | formatting rule to cells based off of
other data cells in the same record.
| | Collapse this transcript |
| Creating labels| 00:00 | Access makes it really easy to generate
a report that is perfect for printing
| | 00:04 | out mailing label sheets.
| | 00:05 | When you're doing your next mailing
campaign or sending out billing notices, you
| | 00:09 | can generate the labels
you will need in no time.
| | 00:12 | Just like our other reports, we'll
first need to identify the people that we
| | 00:15 | want mailing labels for.
| | 00:16 | I'll create a quick query
to gather what we need.
| | 00:19 | I'll go to the CREATE tab
and choose Query Design.
| | 00:22 | Then I'll choose my Customers table
and I'll close the Show Table window.
| | 00:27 | I'll open this up and from my
Customers table I need their FirstName,
| | 00:30 | LastName, I don't need their Phone number,
but I do need StreetAddress, City, State and Zip.
| | 00:38 | To make this labels report really
flexible, I am going to add a quick
| | 00:42 | parameter query to our state, so
that we can print labels for just the
| | 00:45 | customers we need to target.
| | 00:47 | Down underneath the State here, in the
Criteria field, I'm going to type out
| | 00:50 | a parameter request.
| | 00:51 | I'll start with a square bracket
and I'll say Enter State Abbreviation.
| | 00:54 | I'll make sure to close that
with a closing square bracket.
| | 00:58 | Now when I run this query, it will ask
me for the state that I am interested in.
| | 01:02 | If I type ca and press Enter,
it'll generate a list of just my
| | 01:05 | California customers.
| | 01:06 | Okay, let's go ahead and close this query
and create our labels off of it. I'll close it.
| | 01:12 | Access will ask me if I want to save it
and I'll say Yes, and I'm going to call
| | 01:17 | this Customer Mailing Label Query.
| | 01:20 | Go ahead and say OK.
| | 01:21 | Now we'll go up to the Create tab,
make sure that our Customer Mailing Label
| | 01:25 | Query is selected here in the Navigation
pane and then choose this Labels button
| | 01:29 | in the Reports group.
| | 01:31 | That will start the Label Wizard.
| | 01:33 | We can go through and select
which type of labels we have.
| | 01:36 | We could choose a manufacturer here,
and there is a long list of different
| | 01:40 | manufacturers of label sheets.
| | 01:41 | I am going to keep it on Avery.
| | 01:44 | We can choose the size of our label up here.
| | 01:46 | We can look at the product number
| | 01:48 | from the packaging or we can go by the
dimensions of our label at how many there
| | 01:52 | are across on the page.
| | 01:54 | I am going to leave it on this first option here,
the 1 1/2 x 2 1/2 with 3 across.
| | 01:58 | If we needed to specify a custom label size,
we can go into this Customize
| | 02:02 | button and input our own parameters for
the label sheets we have. I'll press Close.
| | 02:06 | Go ahead and say Next and now Access
asks us how we want to format our labels.
| | 02:11 | We can choose a font and a font size here.
| | 02:14 | We can choose whether we want a light
font or a bold font or a medium font.
| | 02:18 | I am going to keep it on Normal.
| | 02:20 | We can change our text color, using the
Build button we can choose any color we want.
| | 02:24 | I'll leave it black and close this window.
| | 02:26 | We can also choose to italicize
or underline our values.
| | 02:29 | I am going to leave both of those off.
| | 02:32 | Go ahead and say Next.
| | 02:33 | Now we get to build the text for our labels.
| | 02:36 | I am going to click on this FirstName and press
the Add button over here to add it over here.
| | 02:41 | I'll press Space to add a space between
those two and then move over to LastName.
| | 02:46 | I'll press Enter on the keyboard to move
down a line and then I'll enter in the
| | 02:49 | StreetAddress by moving it over.
| | 02:51 | I'll press Enter again, I'll do City,
then I'll type a comma and a Space, the
| | 02:55 | State and then a Space and then
the Zipcode, to format my labels.
| | 03:00 | We'll go ahead and say Next.
| | 03:02 | Access asks us then how we want to
sort our labels, let's do an alphabetized
| | 03:06 | list based off of the Last Name.
| | 03:08 | We'll add that over here,
then go ahead and say next.
| | 03:11 | Finally, we get to name our label report.
| | 03:14 | I am just going to call it
Customer Mailing Labels.
| | 03:20 | Now we can see how the labels
look when they will be printed.
| | 03:23 | I'll press Finish, and the query runs.
| | 03:25 | When the query runs, it asks me
which State I am interested in.
| | 03:28 | I am going to type in AZ this time, for
Arizona and press OK and I get a label
| | 03:33 | sheet of just my Arizona customers.
| | 03:36 | If I close Print Preview and go back
and close the Design View of that label,
| | 03:41 | here, I can scroll down in my
Navigation pane down to my reports.
| | 03:45 | I'll find my Customer Mailing
Labels and double-click on it.
| | 03:49 | It again asks which state I am interested in,
I'll type ca again, press OK and
| | 03:54 | we get my labels for California.
| | 03:56 | Now when it opens up this way,
it opens up in layout view.
| | 03:59 | I am going to go ahead and switch
it here to Print Preview to see the
| | 04:03 | three across layout.
| | 04:04 | Now we just need to load the printer
with our label sheets and press Print.
| | 04:07 | Creating, mailing labels is really easy
and when you combine the label report
| | 04:11 | with some of the query tricks that
we've seen, you can get exactly the labels
| | 04:15 | you need without wasting pages
on labels that you don't need.
| | Collapse this transcript |
| Adjusting print settings| 00:00 | Report objects are specifically designed
for the printed page, so it makes sense
| | 00:04 | that at some point we all want to print them.
| | 00:06 | We've been using the Print Preview mode
to check out our layouts and confirm that
| | 00:10 | things are looking the way that they should.
| | 00:12 | But let's take a little deeper
look at the options available in the
| | 00:15 | Print Preview view.
| | 00:16 | Let's go ahead and open up our
Customer Spend report in Print Preview view.
| | 00:20 | I can right-click on it and choose
Print Preview from the pop-up list here.
| | 00:23 | That will open up the form in Print Preview.
| | 00:25 | I can click here to zoom in and scroll up
and down on the report to see how it looks.
| | 00:30 | Now up on the Ribbon we've got options
here to send it directly to the printer.
| | 00:35 | I can adjust its page Size including the type
of paper that we're using and the Margins here.
| | 00:40 | I can choose to print the data only,
which will remove lots of the graphics and
| | 00:44 | color options, I'll turn that back on.
| | 00:46 | I can choose to change my paper
from a Portrait orientation to a
| | 00:50 | Landscape orientation.
| | 00:51 | I can even use this button here to
adjust columns if I wanted to print a
| | 00:55 | multi-column report, go ahead and press Cancel.
| | 00:57 | In this Page Setup button here we have
finer control over some of these other options.
| | 01:02 | For instance I can adjust
the Margins to a specific value.
| | 01:05 | If I wanted to go for instance 1 inch on
the left and a quarter inch all the way
| | 01:09 | around, I can do it that way.
| | 01:11 | Go ahead and press OK to accept that change.
| | 01:13 | But notice, when I go back into the
Print Preview that my report reoriented
| | 01:17 | itself, I might have to go back into the
Design tools to accommodate to this change.
| | 01:23 | Up here in the Ribbon again I can
take a look at this report in other ways.
| | 01:26 | I can take a look at it as a One Page
view which we're doing right now or I can
| | 01:30 | see a Two Page spread.
| | 01:31 | If I wanted to I can see more pages, for
instance I can go to Four, or Eight, or Twelve.
| | 01:37 | Over here on the right we have
ways that we can export this report.
| | 01:39 | I can export it to an Excel file
or even to a PDF file.
| | 01:43 | I can even email it right here
within Print Preview.
| | 01:46 | If I press the Email button, it asks
me what kind of file I want to export.
| | 01:50 | I could choose for instance PDF and say OK.
| | 01:54 | Access packages that up and launches
Outlook, which is my email program, and
| | 01:58 | attaches the file right there.
| | 01:59 | So I can see it right here in the attachment
field ready for me to address and send.
| | 02:04 | I'll go ahead and close this email.
| | 02:07 | Notice though while we're in Print Preview view
that we don't have access to the
| | 02:11 | other Ribbons on the tab.
| | 02:12 | When I want to exit Print Preview,
I'll press this Close Print Preview button
| | 02:16 | over here on the far right.
| | 02:17 | Now you can also get to the
printing options from the FILE tab.
| | 02:20 | If I go to FILE and down to Print, I have
options to Quick Print, which will send
| | 02:25 | the object right to the printer.
| | 02:26 | I can press this Print here, which
will bring up the standard Windows Print
| | 02:30 | dialog box where I can choose a printer
from the list, I can send a to Print to
| | 02:34 | a File or I can change
the number of copies here.
| | 02:37 | Go ahead and say Cancel.
| | 02:39 | So even though it's said that we're
living in a digital age, all too often we
| | 02:42 | still require printouts of our data
to review and share with others.
| | 02:46 | The Print Preview Ribbon allows you
to set all of the parameters you need.
| | 02:49 | Keep in mind though, that some of these
settings will require you to go back to
| | 02:53 | the designers in order to adjust your reports layout,
in order for them to look correct when printed.
| | Collapse this transcript |
|
|
10. Working with MacrosCreating macros| 00:00 | Macro objects allow you to create a series
of actions that you would like to automate.
| | 00:04 | When a macro is triggered, Access runs
through the steps and performs a task for you.
| | 00:09 | In our Navigation pane on the left, I am
going to scroll down to the very bottom.
| | 00:13 | I have got a macro that I set up called Good Morning.
| | 00:16 | This Good Morning macro will open up
all the forms and reports that I want to
| | 00:20 | see as soon as I start my day.
| | 00:22 | I'll double-click on it to run it.
| | 00:24 | And you will see that I get the
Employee Phone List, the Training Department
| | 00:28 | Employees form and the Products Sold
by Department report, all right up on my
| | 00:31 | screen without having to find them
over here in the Navigation pane.
| | 00:34 | Let's go ahead and close these three objects.
| | 00:36 | There are lots of uses for macros
in your Access database.
| | 00:39 | To get started, let's recreate
this Good Morning macro.
| | 00:43 | First, I am going to delete
the one that I have already.
| | 00:46 | I'll right-click on it and say Delete.
| | 00:48 | We'll go ahead and say Yes to confirm
that I do want to delete that object.
| | 00:52 | Now let's go to the CREATE tab and over
here on the right in the Macros & Code
| | 00:56 | group we'll find this big button for Macros.
| | 00:58 | That will start a new macro in Design View.
| | 01:01 | Here in the middle of the screen, I can choose
which actions I want the macro to step through.
| | 01:05 | If I scroll down the list, I can find an OpenForm macro.
| | 01:10 | I'll choose that one.
| | 01:13 | When I choose that action, the
additional arguments and properties for that
| | 01:16 | action show up on my screen.
| | 01:18 | Here I can choose which form I want to open.
| | 01:20 | I have got a dropdown list here that
shows me all of the forms in my database.
| | 01:25 | I can choose the Employee Phone List here.
| | 01:28 | The next line down says View.
| | 01:30 | This will allow me to change
how I want to view my form.
| | 01:33 | I can choose to open up in Form View,
Design View, I can jump straight to Print
| | 01:37 | Preview mode, I can view the Forms
Datasheet or I can change it to Layout view.
| | 01:42 | The PivotTable and PivotChart views have
been depreciated and are no longer valid.
| | 01:46 | Let's go ahead and leave it at Form view.
| | 01:49 | Here, if I have established a premade
filter, I can load that here, or if I
| | 01:54 | know SQL, I can type in an
SQL WHERE condition here.
| | 01:58 | The Data mode will allow me to
choose Add, Edit or Read Only.
| | 02:02 | Add mode will open the form and display
a new blank record at the end, ready for
| | 02:07 | me to add a new record.
| | 02:09 | Edit mode will show me the first record
and allow me to view its data or edit it.
| | 02:14 | And Read Only will load all the data but it
will lock it so that I can't make any changes.
| | 02:19 | I am going to leave it on Add mode,
that will jump me a new record at the end.
| | 02:24 | Finally, our options for Window mode
are normal, Hidden, Icon or Dialogue, I am
| | 02:29 | going to leave mine as a Normal window.
| | 02:32 | Let's go ahead and add another action here.
| | 02:34 | We'll open up another form, our
Trading Department Employees form.
| | 02:37 | I'll go down in the list, scroll down to
OpenForm and here I'll fill in the form
| | 02:44 | name that I want to open,
Training Department Employees.
| | 02:47 | One more action, this time we
are going to open the report.
| | 02:50 | I'll use the dropdown
list and choose OpenReport.
| | 02:55 | The report I want to open is
Products Sold by Department.
| | 03:01 | Now I have established three steps
that my macro will run through.
| | 03:04 | I can press the Run button here to test
it out or I can press Signal Step mode
| | 03:08 | here which will step through one at a time
which is useful when you want to bug test.
| | 03:13 | This button down here, Convert Macros
to Visual Basic will take this macro and
| | 03:17 | change it into Visual Basic programming
language if you want to continue to edit
| | 03:20 | it in that environment.
| | 03:21 | This next group over Collapse & Expand
will allow me to expand or collapse all
| | 03:25 | of my actions which will make it
easier to read what's going on.
| | 03:29 | Now I can easily see the three steps,
OpenForm (Employee Phone List),
| | 03:33 | OpenForm (Training Department Employees) and
then OpenReport (Products Sold by Department).
| | 03:39 | In the Show/Hide group here we
have this Action Catalog toggle.
| | 03:42 | If I turn that off, and then on, you
will see that the Action Catalog is this
| | 03:46 | window over here on the right.
| | 03:47 | It has a listing of all of the actions
that are available in the Macro Editor.
| | 03:51 | I can expand the groups here to see
the various actions and if I want to get
| | 03:55 | some information about an action, I can just
hover over and take a look at the tool tip.
| | 04:00 | Finally, the Show All Actions button
here will turn on some additional actions
| | 04:04 | that will show up with this icon here.
| | 04:06 | The Show All Actions button will
also give you access to actions that
| | 04:10 | are considered unsafe.
| | 04:11 | These are the actions that get blocked
by database that hasn't yet been trusted.
| | 04:15 | Okay, let's go ahead and save
our macro and we'll try running it.
| | 04:18 | I'll press the save icon here
and give it the name Good Morning.
| | 04:23 | Go ahead and say OK and now, I can
press the Run button to see if it works and
| | 04:27 | sure enough, I get my three objects.
| | 04:30 | Let's go ahead and close them down and
I'll also close the Action Catalog by
| | 04:34 | clicking this x here and I'll
close my macro by clicking this x here.
| | 04:39 | Now again, it shows up in my
Navigation pane down in the bottom.
| | 04:42 | I can double-click on it to run and
again, I'll close those three objects.
| | 04:46 | If I want to get back and edit it again,
I need to right-click on it and then go
| | 04:50 | to Design View here, that will
open it back up in the editor.
| | 04:54 | So adding macros to your database can help
automate common and repetitive tasks.
| | 04:58 | Explore the action catalog for various components
that you can apply to your own work.
| | Collapse this transcript |
| Embedding macros into buttons| 00:00 | Macros can activate all kinds of abilities
in your database, and the most common
| | 00:04 | way to trigger them is by pressing a button.
| | 00:07 | Earlier we saw how we can use the
Button Wizard in a form to choose from a
| | 00:11 | predefined list of actions.
| | 00:13 | Using the full Macro Designer we can
get much more control over the functions
| | 00:16 | that our buttons perform.
| | 00:18 | Let's add some buttons to enhance the
functionality of one of our Report objects.
| | 00:22 | I am going to scroll down on my
Navigation pane and find the Products Sold
| | 00:25 | by Department Report;
| | 00:26 | I am going to right-click on
it and open it into Layout View.
| | 00:29 | Now right now this report is showing
all of our Products listed by Department
| | 00:35 | and then within each Department
we have the Category breakdowns.
| | 00:38 | Let's add some buttons here right on
our report to be able to filter out to
| | 00:42 | specific categories that we
might be interested in reviewing.
| | 00:44 | I am going to click up here on the
title bar here where it says Products Sold
| | 00:48 | and then I am going to go to the ARRANGE
tab and choose to Insert a row below,
| | 00:53 | this will be where we'll put our buttons.
| | 00:55 | Now when we do that the layout
grid adds a new row down below.
| | 00:58 | I can click on it to see where it is.
| | 01:01 | It highlights cells when you've selected
them with this orange border, but when
| | 01:04 | they're not selected it has a gray
dashed border, it's really hard to see.
| | 01:08 | so let me change the background color
here so we can see it on the screen.
| | 01:11 | I'll click back here to select this
gray bar in the back, I'll go up to the
| | 01:14 | FORMAT tab, go to Shape Fill and
I'll change it to white, now we can see
| | 01:19 | the gray borders here.
| | 01:20 | Now I need to create the areas
where I want to place my buttons.
| | 01:23 | I am going to click on this large
cell here, go to the ARRANGE tab and I am
| | 01:27 | going to split it horizontally,
that will chop it into two pieces.
| | 01:31 | Now I'm going to need to chop up
these two pieces into two more pieces.
| | 01:34 | So I'll select this first one and
split that one and select this one over
| | 01:37 | here and split that.
| | 01:39 | Now I've got some areas for my buttons.
| | 01:41 | I have one here, here, here, here and here.
| | 01:45 | Now I am going to go back to the
DESIGN tab and in this Controls group I am
| | 01:50 | going to grab a button object.
| | 01:52 | I'll grab it here and then I'll go down to
this first cell and I'll click to add a button.
| | 01:56 | Now I want to double-click on it to edit its text.
| | 01:59 | I'll double-click again to highlight
it and this one is going to say All.
| | 02:02 | This will be the button that will
return us to an unfiltered state.
| | 02:05 | If we need to we can resize the button
by clicking on the bottom and dragging
| | 02:08 | down just a little bit so
we can see the whole thing.
| | 02:11 | Okay, let's add in some more buttons.
| | 02:13 | We'll click another button object
and click into the next cell, then I'll
| | 02:16 | double-click and this one is going to
filter to adjust our Textile category,
| | 02:21 | I'll type in Textiles.
| | 02:22 | All right, let's go ahead and
deselect it and select the next cell.
| | 02:26 | I'll add another button here, I'll
double-click and this one is going to filter
| | 02:30 | just our Home category.
| | 02:33 | Okay we've got two more to do, I'll
click on this one, I'll add a button
| | 02:37 | there, double-click to edit the text and
this one is going to be our Furniture category.
| | 02:45 | And finally I'll click in the next cell,
choose a button and then add it here,
| | 02:50 | double-click and this will
be our Lighting category.
| | 02:54 | So now I have all of my buttons.
| | 02:56 | Now I need to tell these buttons what
they're going to do when we click on them.
| | 03:00 | To do that, I'll open up the Property Sheet.
| | 03:02 | In the Property Sheet we have a tab for Events.
| | 03:05 | The Events tab controls all of the ways that
we can control various actions with our buttons.
| | 03:09 | I am going to choose the Textiles
button first and you'll notice the Property
| | 03:13 | Sheet changed here, now it says
Command60 which is the name of this button.
| | 03:17 | And in the On Click Event, this is
what happens when you click on the button,
| | 03:21 | we're going to create an embedded macro.
| | 03:23 | Rather than create a standalone
macro that takes up space over on an
| | 03:26 | Navigation pane on the left, we can
create a macro whose code is saved
| | 03:30 | directly inside of this button object.
| | 03:32 | I'll click on the Build button over here on the right.
| | 03:35 | Access then needs to know how we want
to construct the macro, I'll choose to
| | 03:39 | use the Macro Builder.
| | 03:40 | Our other options are the Expression Builder
or Code Builder which will allow us
| | 03:44 | to enter Visual Basic code.
| | 03:45 | Go ahead and select Macro Builder and say OK.
| | 03:48 | that will take us into Macro editing
session and I can see that I am inside of
| | 03:53 | that Command button in the
On Click event here, on the tab.
| | 03:56 | Now the action that I want to
choose is an ApplyFilter action.
| | 03:59 | I'll scroll down the list and find it here.
| | 04:02 | The ApplyFilter action will filter my
data that's being fed into the report.
| | 04:06 | I don't have a pre-made filter here
so I need to enter in an SQL filter in
| | 04:10 | this Where Condition.
| | 04:11 | But we have this Build button way over
here on the right, I'll click that and
| | 04:15 | that will bring us the Expression Builder.
| | 04:17 | You might remember the Expression Builder;
| | 04:19 | we take a look at this in the chapter on queries.
| | 04:23 | So now I need to construct my filtering criteria.
| | 04:26 | I can go into my database objects here,
into my Tables here, into my Products
| | 04:32 | table I'll double-click on Category to
add that to the syntax and now we just
| | 04:37 | need to say what I want the
category to equal when I press that button.
| | 04:41 | That was the textiles button so the (
Product)!(Category) is going to equal (=)
| | 04:44 | and then in quotation mark "Textiles".
| | 04:47 | Go ahead and say OK, that is our filtering criteria.
| | 04:51 | I can go ahead and close the Action and
save any changes and now that button is
| | 04:57 | done, you can see the On Click Event
has changed to the (Embedded Macro), let's
| | 05:01 | do one for the Home.
| | 05:02 | I'll click here on the Home button,
on the On Click event in the Property
| | 05:06 | Sheet I'll click Build;
| | 05:08 | I'll open up the Macro Builder and say OK.
| | 05:11 | Once again, we're going to choose apply filter.
| | 05:13 | This time I am just going to type
App and it jumps right to ApplyFilter.
| | 05:18 | I'll press Enter, for the where condition
I'll go to my Builder, I'll dig into
| | 05:24 | my database object here, into Tables,
my Products Table and I'll double-click
| | 05:30 | on the Category Expression Category
here, = "Home", go ahead and say OK and
| | 05:40 | we'll close the Macro.
| | 05:41 | Save the changes and there is those two.
| | 05:44 | I am not going to do Furniture and
Lighting, I think you can see the pattern
| | 05:48 | here, but I do want to do the All one,
that one that's slightly different.
| | 05:52 | Here we're going to go to the On Click event, Build;
| | 05:54 | Macro Builder once again, we'll say OK.
We're going to use the same
| | 05:59 | ApplyFilter, the Where Condition here
and then once again click on the Build
| | 06:04 | button on the far right.
| | 06:05 | I'll go into my database, choose from
the Tables and the Products table and
| | 06:11 | we'll get the Category field.
| | 06:12 | I am going to say equals (=) here.
| | 06:14 | And then what I want the
Category to be equals to is True.
| | 06:19 | I am not saying here that I want the
Category to be the name True, but what I'm
| | 06:23 | saying since I am not wrapping it in
quotation marks, is that there is a
| | 06:27 | category of some sort.
| | 06:28 | If there is a category then I want to display it,
this will show me all of my categories.
| | 06:33 | Go ahead and say OK, I'll close the
Macro Editor, Save the changes again and
| | 06:38 | there is my first three buttons,
let's go ahead and test them out.
| | 06:42 | I'll switch my view into Report View by
clicking the top half of the View button
| | 06:46 | and I am going to click on the Textiles button.
| | 06:48 | And you can see that my categories
have filtered to just the Textiles.
| | 06:52 | I'll click on Home and you'll see now
I am looking at just my Home categories
| | 06:56 | within each department.
| | 06:57 | I'll click on the All button
to return to a unfiltered state.
| | 07:01 | Now the nice thing about this report is that
if you remember when we constructed it,
| | 07:04 | is that we created some calculated
statistics down here at the bottom.
| | 07:08 | Right now what I'm looking at all
products, I can see that I've got eight
| | 07:11 | products in the Bath department here,
there is the number 8.
| | 07:15 | The total number of sold was the 612
and this is the total dollar value that
| | 07:19 | they've contributed.
| | 07:20 | If I filter it by clicking on the Home
button for instance, you can see now that
| | 07:24 | these statistical lines update.
| | 07:25 | Now I've got three categories in the
Bath department, for a total number of sold
| | 07:29 | of 69 and there is their value.
| | 07:31 | If I switch to Textiles, you can see
there they update again.
| | 07:35 | So rather than clutter up our Navigation pane
with lots of one-time use macro
| | 07:39 | objects, we can often create embedded
macros that are attached directly to the
| | 07:43 | button that activates them.
| | 07:44 | And using a macro to filter our data on the fly
makes our Reports and Forms even more flexible.
| | Collapse this transcript |
| Attaching data macros to tables| 00:00 | Data macros are macro events that are
triggered when something changes in a data table.
| | 00:05 | They're most commonly used to essentially
watch what gets entered into the table and
| | 00:08 | then respond to that entry event by
creating a log, noting the change that happened
| | 00:13 | and recording the time and
date when the change was made.
| | 00:16 | Let's create a simple logging system to
keep track of the changes that are made to the
| | 00:19 | No Obstacle Company's Employee JobRatings.
| | 00:22 | First, let's take a look at
the existing Employees table.
| | 00:24 | I'll find it in the Navigation
pane and I'll double-click to open it.
| | 00:28 | Now if I scroll over to the right, you can
see that each employee has a JobRating.
| | 00:33 | Right now it's a scale of 1 to 5.
| | 00:36 | What I want to do is set up a
system that logs changes to this rating.
| | 00:39 | So if somebody's JobRating changes from
a 5 to a 4, for example, I want to create
| | 00:44 | a record in a new table noting that change.
| | 00:47 | I want to know when the change happened, what
the original number was, and what the new number is.
| | 00:52 | Let's go ahead and set that system up.
| | 00:54 | I'll go ahead and create a new table to hold the log
by going to the CREATE tab and choosing Table Design.
| | 01:01 | The first field in our table is going to be
the ID for this table, I'll call it LogID.
| | 01:04 | I am going to choose a Data Type here of
AutoNumber, this will be our primary key field,
| | 01:11 | so I'll press a Primary Key button here on the Ribbon.
| | 01:14 | The next field will be the foreign key,
this is how we will link back to the Employees
| | 01:18 | table and we'll do that
based off of the EmployeeID.
| | 01:21 | I'll go to Data Type and choose Number.
| | 01:26 | The next field here will
hold the old job rating.
| | 01:29 | This is the rating as it is
before the change was made.
| | 01:31 | I'll call it OldRating with a no
space and Data Type here will be a Number.
| | 01:37 | Now I want a cell for the new rating, I'll
call it NewRating with no space and again
| | 01:41 | the Data Type will be Number.
And finally, I want a date stamp here.
| | 01:45 | I'll type DateStamp for the Field Name with no
space and the Data Type will be a Date/Time Data Type.
| | 01:52 | So there is our table, let's go ahead and
save it using the Save icon on the Quick Access
| | 01:56 | toolbar and I'll change its name to
EmployeeRatingLog and go ahead and say OK,
| | 02:02 | and finally, we'll switch into Datasheet view.
| | 02:05 | We don't have any records here so we are
going to wait and we'll go back into our
| | 02:08 | Employees table and we'll finish
up by adding a data macro.
| | 02:12 | I can add a data macro by
going to the TABLE tab here.
| | 02:16 | The TABLE tab has all of the
events that will trigger macros.
| | 02:19 | I have Before events, these are things that
will trigger Before a record is updated and
| | 02:24 | I have After events, the After Events
will trigger after a change is made.
| | 02:28 | You'll notice if you hover your mouse over
the After Update button, you'll get
| | 02:32 | a tool tip telling you how it works.
| | 02:34 | This says that it creates logic that runs
after an existing record has been changed
| | 02:37 | and the last paragraph is important,
it says use Old.Field Name to inspect the value
| | 02:42 | of a field before the record was changed.
| | 02:45 | We're going to need to know that syntax here in just
a moment, Old.Field Name to inspect the value before.
| | 02:50 | Okay, so let's go back and press this After
Update button and I'm going to start with our Macro.
| | 02:57 | Now the first thing we want to know is that
the After Update will fire any time any changes
| | 03:02 | are made to an employee, not necessarily
changes that are made to their JobRating.
| | 03:06 | So the first thing I want to do is know if
a change occurred to the JobRating field.
| | 03:10 | I am going to insert an If block by double-
clicking it on the Action Catalog over here on the right.
| | 03:16 | If the Action Catalog isn't Open, you can
toggle it open using this button here on the Ribbon.
| | 03:21 | That will add this If statement here.
| | 03:23 | So first I need to test if the new
JobRating is the same as the old JobRating.
| | 03:28 | If it's the same, then that means that no
changes were made to JobRating, the change
| | 03:32 | was made somewhere else in the record.
| | 03:33 | So I am going to type in a reference to
the JobRating field by using a square bracket
| | 03:39 | and typing JobRating and as you can see as soon as I
start typing, Access suggests the values that are valid.
| | 03:44 | I'll go ahead and press Tab to accept this
JobRating value right down here. That will fill it in for me.
| | 03:50 | Now I can say JobRating= and this is where we
remember that the old JobRating is available if we type old.
| | 03:58 | and then the Field Name again is JobRating.
I can also select it from the list here.
| | 04:06 | So if JobRating=old.JobRating
then we'll run this action here.
| | 04:11 | The action we want to do is just StopMacro.
| | 04:15 | That way if no changes
were made, the macro will end.
| | 04:18 | If a change was made, however, we'll
go down here, we'll add an Add Else.
| | 04:22 | If a change was made, we want to create
a new record in that EmployeeRatingLog.
| | 04:28 | We'll choose CreateRecord, Create a Record In, I can choose
which table I want to create the record in. EmployeeRatingLog.
| | 04:38 | Now we'll set up the
actions to fill in the fields.
| | 04:41 | From the list we'll choose SetField, the
field that we want to set is the EmployeeID and
| | 04:50 | the Value is going to be the value
of the Employees table EmployeeID.
| | 04:56 | So it reads Employees.EmployeeID.
| | 05:07 | So set the Field, EmployeeID to whatever value
the EmployeeID is of the record that's changing.
| | 05:12 | We'll add another SetField here.
| | 05:15 | SetField, this time we are going to set the value
of the old rating field in our EmployeeRatingLog.
| | 05:22 | And down here the value of that is going to be
whatever the old JobRating was, Old.JobRating.
| | 05:38 | We've got another field to add here, SetField.
| | 05:43 | We'll set the new rating field, and down here I'll change
it to the reference to the JobRating in the Employees table.
| | 05:54 | And finally we need to at add our DateStamp,
so we'll add one more SetField, the name of
| | 06:00 | this one is going to be the DateStamp field,
that's in our EmployeeRatingLog and the Value
| | 06:06 | for this is going to be now().
| | 06:11 | That's code to just pull the today's Date/
Time and apply it to the DateStamp field.
| | 06:15 | Now just looking through here I notice
that I had a typo here, I've got this Name set
| | 06:18 | to Old and that should have been OldRating is the
actually name of the Field in the EmployeeRatingLog.
| | 06:23 | Okay, so let's walk through this step by step.
| | 06:26 | I'm going to Collapse the Actions here to
scrunch everything down over the screen and
| | 06:31 | I'll go here and Collapse again, okay.
| | 06:36 | So let me read through this, it says if the
JobRating is the same as the old JobRating,
| | 06:41 | then nothing has changed
and we are going to StopMacro.
| | 06:43 | Otherwise, we are going to Create a
new Record in the EmployeeRatingLog.
| | 06:49 | The fields in that record are
going to get set to these values here.
| | 06:52 | We'll set the field EmployeeID to the
EmployeeID from the record that's changing.
| | 06:57 | We're going to set the field OldRating to the
value of the OldRating before we create the change.
| | 07:02 | We are going to set the field NewRating to
the newest rating and we are going to set
| | 07:06 | the field DateStamp to
whatever the current date and time is.
| | 07:10 | Let's go ahead and close our Action and we'll save
our changes to it and that will complete the process.
| | 07:16 | So now it's just a matter of
going through and checking.
| | 07:18 | I am going to go to this first record here,
the JobRating that I previously changed from
| | 07:22 | a 5 to a 4 and I'll highlight it, I'll type
in a 5, and then I'll click off of this record
| | 07:28 | to apply that change to the table.
| | 07:30 | Now let's go back to our EmployeeRatingLog, which
is still open in the background and take a look.
| | 07:35 | It doesn't show up automatically but if I
press the Refresh button, you should get a
| | 07:38 | new line noting that EmployeeID 1 had an
OldRating of 4, a NewRating of 5, and this DateStamp
| | 07:45 | field here will show the exact time and date
down to the second that I made that change.
| | 07:50 | If I go back to the Employees table and
make another change, I'll just go down here and
| | 07:54 | change this 5 to a 4 and click off of it,
go back to my RatingLog and refresh the data
| | 08:01 | and you can see that I changed Employee ID 12
from the OldRating of 5 to 4 at this time and date.
| | 08:08 | Now because this is attached to the Table,
any changes to the table will affect the log.
| | 08:13 | But I can go ahead and close the table and
go into our form that we created earlier,
| | 08:18 | this Training Department Employees, I'll
open that up, and this JobRating here, we will
| | 08:23 | convert it to an Option Group.
| | 08:25 | But any changes that we have here are being
saved back to the table, so if I change this
| | 08:30 | Employee here, from Needs Improvement to
Good and then click this pencil icon to save the
| | 08:37 | changes to the table, go back to my RatingLog,
refresh the data, you'll see that I changed
| | 08:43 | employee 670, the OldRating was 1, it's
now 4 and that's exactly when I did it.
| | 08:50 | Creating an automatic change log system is a great
way to integrate DataMacros into your Database.
| | 08:55 | By keeping a running timestamp record, you
can not only find the current value for a
| | 08:59 | field, but you can see the entire historical record of
how that field's value has fluctuated over time.
| | Collapse this transcript |
| Launching macros at startup| 00:00 | It might be useful to have a macro run
immediately when the database is first opened.
| | 00:05 | We could do that by giving one of our
macro objects a very special name.
| | 00:09 | Let's create a macro that will run at startup.
| | 00:11 | I'll go to the Create tab and create
a new Macro in Design View here.
| | 00:15 | First thing I want to do is have a little
message box pop up welcoming us to the
| | 00:19 | No Obstacles Database.
| | 00:20 | I'll type in M E and that will
jump me to the MessageBox action.
| | 00:25 | I'll press Enter and here we can fill in the details.
| | 00:28 | The message is going to be
Welcome to the No Obstacles Database.
| | 00:31 | If you have any questions, please ask Adam.
| | 00:35 | We could choose whether we want the
MessageBox to Beep or not, I am going
| | 00:38 | to change that to No.
| | 00:39 | We can have a Type here, it can either be a None,
| | 00:42 | it can be a Critical message, a
warning or an Informational message.
| | 00:46 | This will define what icon displays to the left of it.
| | 00:49 | I am going to leave it as None.
| | 00:51 | And we can have a Title here that will
appear at the top of the MessageBox.
| | 00:55 | I am going to put in the No Obstacles
tagline, Defy Obstacles, Live Boldly.
| | 00:59 | So now that our MessageBox is complete,
the next action I want to do is get our
| | 01:03 | database started by opening up our Navigation Form.
| | 01:05 | Here I'll choose OpenForm from the list,
the FormName I'll choose that from the list.
| | 01:11 | It's going to be our Navigation Form.
| | 01:14 | We can choose our View mode here.
| | 01:16 | the options again are Form view,
Design view, Print Preview or Layout.
| | 01:20 | I am going to switch to Form view
so we can get to work.
| | 01:23 | We don't need to apply any filtering and
I'll leave these other settings the same.
| | 01:27 | So there is our Macro, now the magic
here is that we are going to call this with
| | 01:30 | a name that's very special that will
tell Access to run this Macro every time
| | 01:34 | the database starts up.
| | 01:35 | I'll go ahead and press the Save icon
up here and the name I want is autoexec
| | 01:40 | a-u-t-o-e-x-e-c, which
is short for Auto Execute.
| | 01:45 | Go ahead and say OK and that
creates our Auto Execute Macro.
| | 01:49 | I can test it here by pressing the Run button
and we'll get our MessageBox here
| | 01:52 | that's welcoming me to the database,
I'll say OK and then my Navigation Form
| | 01:57 | opens up ready to get started for the day.
| | 01:59 | Lets go ahead and close that down
and I'll close the Action Catalog and
| | 02:03 | close the macro here.
| | 02:05 | Now let's test it out to see if it runs at start up.
| | 02:07 | I'll go to the File tab and say Close.
| | 02:11 | Then I'll go back to the File tab, I'll
say Open and from my Recent's list,
| | 02:16 | I'll choose the current exercise file here.
| | 02:18 | That will start up.
When the Database starts the macro runs.
| | 02:22 | Here is my text box here telling me
that it's welcoming me to the database and I
| | 02:26 | ask myself if I have questions.
| | 02:28 | Go ahead and say OK and there is my
Navigation Form so I can get started with my work.
| | 02:33 | The Auto Execute Macro is a great
little hidden feature that can help you get
| | 02:37 | your users to where they need to go,
right when they open up the database.
| | 02:41 | But if you ever need to bypass the
autoexec macro, for instance I'll close this
| | 02:45 | out and File>Close my database, I can
do that by going to the File button, Open
| | 02:52 | and then holding down the Shift key on
your keyboard when you open up the file.
| | 02:55 | You'll notice now that that will bypass
the start up option and that the
| | 03:00 | Autoexec Macro doesn't run.
| | Collapse this transcript |
|
|
11. Integrating Access with the Office SuiteExporting tables to Excel| 00:00 | There will be times when you want to move
your data out of Access in order to
| | 00:03 | perform some further analysis with
the tools available in Excel, such as
| | 00:07 | charting or pivot tables.
| | 00:09 | In order to do that we need export
our data to an Excel file.
| | 00:13 | First, we need to select
the object we want to export.
| | 00:16 | I'll choose my Customers-MidwestRegion query here.
| | 00:19 | Then I'll go up to the EXTERNAL DATA
tab and take a look at our Export group.
| | 00:24 | Here, we have options to export to an
Excel file, we can also export to a Text
| | 00:28 | File, an XML file, a PDF or XPS file
or we can export to an Email, an Access
| | 00:34 | database a Word Mail Merge and under
More we have some additional options.
| | 00:40 | Let's go ahead and choose the
Excel button here in the Export group.
| | 00:43 | Make sure you are not pressing the Excel
button over here that's in the Import group.
| | 00:48 | When I press the button, the Export wizard starts.
| | 00:51 | First I need to tell it where I want to save it.
| | 00:53 | I'll click the Browse button over here
and I'll browse out to my Exercise folder,
| | 00:57 | which is on my Desktop
| | 00:59 | in the exercise files folder, in the Ch 11 folder.
I'll go ahead and give it a name here.
| | 01:06 | I can also choose which type of file I want.
| | 01:08 | I can choose an Excel Binary Workbook,
a standard Excel Workbook, a Microsoft
| | 01:13 | Excel 95 Workbook or an
Excel 97 to 2003 Workbook file.
| | 01:17 | I am going to choose the standard
and current version one hear.
| | 01:21 | Go ahead and say Save and that
will return us back to the wizard.
| | 01:24 | Here again we can choose our file to
confirm and we have a couple of additional
| | 01:28 | options at the bottom.
| | 01:30 | We can choose to Export our data
with formatting and layout.
| | 01:33 | I generally turn this one on, not necessarily
because I want the formatting, but
| | 01:36 | because it unlocks the other option
below which I find really handy to open the
| | 01:40 | file after the Export is run,
go ahead and select that one as well.
| | 01:44 | Now if you have previously made a selection
in your Data Source, you can also
| | 01:47 | export only the selected records.
| | 01:50 | Go ahead and press OK and the Export will run.
| | 01:53 | Excel will go ahead and open up and display our data.
| | 01:56 | I am going to go ahead and close Excel
and that will return us back to Access.
| | 02:02 | Now when I come back to Access the wizard
has changed, now it says Save Export Steps.
| | 02:07 | I can choose to Save those export steps if I
want to re-run the export at a future point.
| | 02:11 | I am going to go ahead and say Save export.
| | 02:14 | We can give it a name here,
Export-Customers-MidwestRegion, that name is fine for me.
| | 02:19 | We can also give it a Description, something
like export monthly on the 15th of the month.
| | 02:25 | We can also choose to Create an Outlook Task.
| | 02:28 | This will create a reminder for you in Outlook.
| | 02:31 | Go ahead and say Save Export.
| | 02:33 | Now when you want to redo the Export,
you can just go up to your Save Exports here,
| | 02:37 | choose the one you want and press Run.
| | 02:41 | Access will reexport the file and if
it's already there it will overwrite the
| | 02:45 | existing one so we can say Yes and
the Export runs and we have our current
| | 02:51 | snapshot now saved as an Excel file.
| | 02:53 | Exporting your data to Excel, or indeed
any number of the available export types,
| | 02:58 | is a straightforward procedure.
| | 03:00 | And as if it weren't easy enough, you
can even save the steps and rerun them
| | 03:04 | next time with just a single-click
using the Save Export Options.
| | Collapse this transcript |
| Emailing with macros| 00:00 | Not a day goes by that I don't have to
email several files off to various people.
| | 00:04 | If you're like me, I'm sure you find
yourself constantly exporting files,
| | 00:08 | saving them to your hard drive, opening
your email program, then attaching the
| | 00:12 | file and sending it off.
| | 00:13 | That's a lot of work for
something we do so regularly.
| | 00:16 | I would much rather press
one button and be done with it.
| | 00:19 | Well using what we've seen about
macros, we can do just that and it's a
| | 00:22 | fantastic time saver.
| | 00:24 | I'm going to open up this Customer Spend
report that my boss has decided that
| | 00:28 | she would like emailed to her once a week.
| | 00:31 | Rather than go to the process of exporting it
to a PDF, then manually creating
| | 00:34 | a new email and attaching it, we can
simply use the built-in Export to Email option.
| | 00:39 | You can find it on the EXTERNAL DATA
tab here and then the Email button here.
| | 00:44 | I'll press the button and Access asks
me what kind of object I'd like to send,
| | 00:48 | I'll choose PDF and press OK.
| | 00:51 | Access packages up the email as a
PDF and attaches it to an email right
| | 00:55 | inside of Outlook for me.
| | 00:57 | Now I can just address it and send it off.
| | 00:59 | But believe it or not that was
actually the hard way of doing that.
| | 01:03 | I'm going to close the email without
sending it and return to Access.
| | 01:07 | In my case, I know I always want to send
this report as a PDF, and I also always
| | 01:11 | know who it's going to.
| | 01:13 | I can save even more steps
by creating a simple macro.
| | 01:15 | I am going to open up this report in
Design View by going to the HOME tab and
| | 01:20 | changing my View to Design View here.
| | 01:21 | I am going to add a button
to the top of my report here.
| | 01:25 | Up in the DESIGN tab, in the Controls group;
| | 01:27 | find the button object which is
this one right here with the Xs in it.
| | 01:31 | Go ahead and click that, and then down here
in the header, click once to add a button.
| | 01:36 | Now I will open up the Property Sheet
to define what this button is going to
| | 01:40 | do when I click on it.
| | 01:41 | Go ahead and open up the Property
Sheet here, then go to the Event tab.
| | 01:45 | I am going to go to the On Click event
here and on the far right press the
| | 01:49 | Build button over here.
| | 01:51 | Access asks us how we
want to construct our code.
| | 01:54 | I am going to use the
Macro Builder and choose OK.
| | 01:57 | Now we are going to create an embedded
macro that's attached to that button,
| | 02:00 | that's on our report.
| | 02:02 | I am going to say my Action is
going to be EMailDatabaseObject.
| | 02:05 | I'll just write in the word EMail
and Access jumps right to that action.
| | 02:10 | I'll press Enter to accept that and all
of the properties show up for this action.
| | 02:15 | Now I can tell it what I want to email.
| | 02:17 | The Object Type is a report, so I'll
type Report, the Object Name, that's our
| | 02:22 | Customer Spend report,
so I'll type in Customer Spend.
| | 02:26 | Output Format, here I can specify that
I always want it to be a PDF, that way it
| | 02:32 | won't ask me every single time.
| | 02:34 | On the To line I will specify who I want it to go to;
| | 02:37 | jleonard@no-obstacles-inc.com.
| | 02:41 | I can specify Copy lines or Blind Copy lines.
| | 02:43 | I can even specify a Subject;
| | 02:45 | Here is the Customer Spend report.
| | 02:50 | On the next line down, I can enter
the Message Text that I want to say;
| | 02:54 | Please find the pdf file attached.
| | 02:59 | Finally we have a chance to edit
the message here in Outlook.
| | 03:02 | I am going to leave that set to Yes so
that I can have a chance to review the
| | 03:07 | email before sending it off.
| | 03:07 | Okay, we're done with our macro.
We can go up to the Quick Access toolbar and
| | 03:12 | press Save to save it and
then close our macro here.
| | 03:15 | Now we're back into Design View of our report,
I'll switch my View to Report View.
| | 03:20 | Now when I'm viewing my report,
I can press this button here, Access will
| | 03:23 | package up the email as a PDF, address it,
attach it, put in the Subject, put in
| | 03:29 | the body text, and now all
I have to do is press Send.
| | 03:32 | Now I can hear some of you saying,
but Adam I don't really want an ugly button
| | 03:35 | at the top of my beautifully crafted report.
| | 03:37 | Well, if we switch back into Print Preview mode
here by closing Outlook and
| | 03:41 | changing our View to Print Preview,
you'll notice that the button doesn't even
| | 03:45 | show up in Print Preview mode.
| | 03:47 | So using just a little ingenuity and
problem-solving skills, we were able
| | 03:51 | to boil down what was once a time-consuming
and repetitive task to just a few simple clicks.
| | 03:56 | You can either use the built-in Export
Email option or with just a little more
| | 04:00 | upfront setup, with a one click macro button.
| | Collapse this transcript |
| Linking to data in an Outlook database| 00:00 | You may not have realized it, but the
Microsoft Office suite contains another
| | 00:04 | great database program.
| | 00:06 | Outlook maintains tables in its own
database of all of your emails, contacts,
| | 00:10 | tasks and calendar events.
| | 00:13 | We can dig into that database from
inside Access in order to easily bring that
| | 00:16 | information in from Outlook.
| | 00:18 | To get your Outlook database you go up
to the EXTERNAL DATA tab and choose in
| | 00:22 | the More group, Outlook folder.
| | 00:25 | This will start the External Data wizard.
| | 00:27 | We can choose to import the data into a
new table, Append a copy of the records
| | 00:31 | to an existing table or Link to the
data source by creating a linked table.
| | 00:36 | By creating a linked table we allow
access to keep up to date with what's
| | 00:40 | happening in Outlook.
| | 00:41 | When we add a new calendar appointment
or a task, Access will immediately see
| | 00:45 | those changes when we've
linked the tables together.
| | 00:47 | I am going to choose this
Link option and press OK.
| | 00:51 | Now we can see inside of
the Outlook database file.
| | 00:53 | I am going to go into the user account
here and choose Inbox and press Next.
| | 01:00 | We can go ahead and give it a name;
| | 01:01 | this is how we want it to appear here
on our Navigation pane, I will choose
| | 01:05 | Inbox is fine, go ahead and say Finish.
| | 01:09 | Access links to the tables and we can say
OK to take a look inside of our database.
| | 01:14 | I'll scroll up to get back to my Tables
group and down here at the bottom I've
| | 01:18 | got the Inbox table.
| | 01:19 | You can see it's a linked to
Outlook table with this icon.
| | 01:22 | If I double-click on it to open it,
you can see the contents of the inbox,
| | 01:26 | including Priority status, the Subject
of each email and who they are from as
| | 01:31 | well as any message text or body text.
| | 01:34 | Once your tables are imported into Access, you
can view them right here and make use of them.
| | 01:39 | You can also use them as
you would any other table.
| | 01:41 | You can establish relationships to
other tables based off of a common field or
| | 01:45 | create queries or reports off of them.
| | 01:46 | For example, you could generate a
report to show the productivity of each month
| | 01:51 | as measured by the number of completed tasks,
or you might want to use the
| | 01:55 | addresses in your contacts
list to setup mailing labels.
| | 01:58 | How about a query that finds the
number of emails that mention a specific
| | 02:01 | product, sort it by the region the customer is from?
| | 02:05 | The possibilities are endless.
| | 02:07 | If you're an Outlook user you probably
have lots of data already stored in
| | 02:10 | your Outlook database.
| | 02:11 | Bringing it into Access can help free
it up so that you can use it for rich,
| | 02:15 | in-depth analysis or reporting.
| | Collapse this transcript |
| Setting up labels and mail-merge documents in Word| 00:00 | Using the data stored in your Access
database, you can easily populate Mail
| | 00:04 | Merge documents in Word to create
personalized letters, envelopes and other
| | 00:08 | types of correspondence.
| | 00:10 | We are going to create a letter that is
tailored to each of our 200 customers.
| | 00:14 | To start, I am going to scroll up in my
Navigation pane and choose the Customers table.
| | 00:18 | Then I am going to go to the EXTERNAL DATA tab
and choose Word Merge here on the far right.
| | 00:24 | When I do that, the Microsoft
Word Mail Merge Wizard opens.
| | 00:27 | It asks, what do I want the wizard to do?
| | 00:30 | I can either link to your data to an
existing Microsoft Word document or we can
| | 00:34 | start a brand-new document
by clicking this button here.
| | 00:37 | I am going to start a new letter,
so I will go ahead and say OK.
| | 00:40 | When I do that, Word starts up,
I can go ahead and go open it here in the
| | 00:44 | background and I am going to
maximize Word, and we can see that the Mail
| | 00:49 | Merge Wizard has started over here on
the panel on the right, we have some
| | 00:52 | options here and I can also start
writing out my letter by inserting Merge
| | 00:56 | Fields from this button here.
| | 00:58 | So I am going to start my letter
with the address for my customers.
| | 01:01 | I am going to insert the field
FirstName and then type a space and then
| | 01:05 | insert the field LastName.
| | 01:07 | I am going to press Enter to go down
to the next line and then I will insert
| | 01:10 | the StreetAddress line.
| | 01:12 | I will press Enter to go down a line.
| | 01:14 | Then I'll enter in the City comma space,
choose the State and space
| | 01:22 | and choose Zipcode.
| | 01:24 | Now I will press Enter a few times
and I will type out the word Dear, put a
| | 01:28 | space and I will go back up one more
time and select FirstName and press comma.
| | 01:34 | For the body of my letter, I have got a
text file saved in the Exercise folder.
| | 01:38 | So let me go grab that.
| | 01:39 | I will go back out to Windows
Explorer and I am going to choose the
| | 01:43 | MailMerge text document.
| | 01:44 | I will select it and press Ctrl+A on my
keyboard to select all of the text and
| | 01:49 | then Ctrl+C to copy it.
| | 01:51 | I can go ahead and close Notepad
and I will return back to Word.
| | 01:55 | Now back in my MailMerge, I am going
to press Enter a few times, and I will
| | 01:59 | press Ctrl+V on my
keyboard to paste in the text.
| | 02:02 | We can go ahead and modify our
spacing however we would like and that's
| | 02:06 | looking pretty good.
| | 02:07 | So let's go ahead and view the results.
| | 02:08 | I can scroll up to the top.
| | 02:10 | In the Preview Results group,
I will press this Preview Results button.
| | 02:14 | Now the letter is being populated
with data from the database.
| | 02:17 | I can scroll through the various
records to see how it looks with
| | 02:20 | different individuals.
| | 02:22 | Now we have got a customized letter for
each one of our customers, ready to be mailed.
| | 02:27 | Pairing your Access database with
powerful capabilities of Word's Mail Merge
| | 02:30 | feature is a great way to get more
out of the data you've been diligently
| | 02:34 | collecting and organizing.
| | 02:35 | For more information on using Microsoft Word,
please take a look at Word 2013
| | 02:39 | Essential Training here at lynda.com.
| | Collapse this transcript |
|
|
12. Maintaining the DatabaseOrganizing the Navigation pane with custom groups| 00:00 | Now that our database is filling up
with objects, you might want to consider
| | 00:03 | reorganizing your Navigation pane, so
that your objects are grouped by task
| | 00:07 | rather than by object type.
| | 00:09 | We can create custom groups, so that
all of the objects that go together will
| | 00:13 | appear next to each other, regardless
of whether they are forms, queries,
| | 00:16 | tables, reports, or macros.
| | 00:18 | We will start by changing the
View mode on the Navigation pane.
| | 00:21 | Click on the down arrow here and
change it to Tables and Related Views.
| | 00:25 | Now Access groups all of our objects
based off of their relation to each table.
| | 00:29 | You will notice that we get duplicates
of each object such as this
| | 00:32 | EmployeePhone Crosstab is related to
both the EmployeePhone table and if I
| | 00:36 | scroll down, the Employees - Table.
| | 00:40 | Just like sorting by object type, we
can use the up arrows on these categories
| | 00:43 | here to collapse each group.
| | 00:46 | If you would like to have full control
over the groupings of your objects, go
| | 00:50 | back up here to the top and
change it to Custom group.
| | 00:53 | I will go ahead and scroll up to the
top of my Navigation pane and you will
| | 00:57 | see that I have two groups now, one
called Custom Group 1 and another called
| | 01:01 | Unassigned Objects.
| | 01:02 | We can group objects together based off of the
relationship to each other or a particular task.
| | 01:07 | To add objects to a group, simply drag and drop.
| | 01:10 | For instance, I am going to make a
group that's all about our customers.
| | 01:14 | I am going to take the Customer table and
drag and drop it up into Custom Group 1 up here.
| | 01:18 | Now I can right-click on it and choose
Rename and I am going to rename the
| | 01:22 | Custom Group to Customers.
| | 01:24 | I will make sure it's expanded.
| | 01:26 | Now I can drag other objects into it,
for instance CustomerCreditCards.
| | 01:30 | I will click and drag that up as well.
| | 01:32 | I can scroll down through my database
and I will find some other things that
| | 01:35 | relate to the customers, for instance,
this Customers Mailing Label report.
| | 01:38 | I will click and drag it up to
the top and drop it in the list.
| | 01:43 | Let me scroll back down.
| | 01:45 | We have got some queries I want to add as well.
| | 01:48 | Rather than drag and drop, I can right-click
on them, for instance this Customer
| | 01:52 | Spend query, I will right-click on it
and choose Add to group>Customers.
| | 01:57 | Now let's add a different group.
| | 01:58 | I am going to right-click on the Products table.
| | 02:00 | I will go Add to group and
this time I will choose New Group.
| | 02:05 | That adds a new custom group at
the top of the Navigation pane.
| | 02:08 | Once again, I will rename this one, right-click,
Rename and I will change this to Products.
| | 02:14 | Now I can add things to that as well.
| | 02:16 | I will right-click on Products - Furniture>Add
to group>Products, products -
| | 02:21 | Textile tables as well, Add to group>Products.
| | 02:24 | We can scroll down.
| | 02:25 | How about the Products Sold query?
| | 02:27 | I will right-click on it, Add to group>Products.
| | 02:31 | I can go through my entire database and
organize everything based off the common task.
| | 02:35 | If you would like later to delete your
Custom groups, just right-click on the
| | 02:39 | heading and go to Delete.
| | 02:41 | Notice that all of the products then
get put back into this Unassigned Objects
| | 02:44 | group here at the bottom.
| | 02:46 | Having multiple organization scenes
set up for your objects in your database
| | 02:49 | makes it easy to manage all the components
and quickly find the ones you want to work with.
| | 02:54 | Once you have set up your custom groups,
you can switch back and forth to the
| | 02:58 | other grouping options as needed.
| | Collapse this transcript |
| Compacting and repairing the database| 00:00 | When working with you Database files,
Access keeps track of changes that you are
| | 00:04 | making in the background, and when you
delete an object, or lots of records,
| | 00:08 | Access doesn't actually give you
that disk space back right away.
| | 00:11 | If you notice your Database is running slower,
or you would like to squeeze
| | 00:15 | the file size down as much as possible you
can use a little tool called Compact & Repair.
| | 00:19 | You will find Compact & Repair either
on the DATABASE TOOLS tab, here at the
| | 00:23 | beginning, or on the FILE tab in the Info
group here, either way will run the same tool.
| | 00:31 | Go ahead and press the button, Access
will close the Database file then run
| | 00:34 | through some routine maintenance
tasks, it throws out old log files and
| | 00:38 | rebuilds indexes, and generally cleans
up after itself, then the Database file
| | 00:42 | is saved again and reopened.
| | 00:44 | For some databases, the Compact &
Repair process is so quick, you might only
| | 00:48 | notice a little blink as the file
is shut down and reopened.
| | 00:51 | For others with lots of tables and records,
it might take a bit more time and
| | 00:55 | you'll see a Status bar in the
bottom of your screen down here.
| | 00:58 | Depending on the size of your database
file and how long it's been since the
| | 01:02 | last time Compact & Repairs has run,
you might see a dramatic decrease in the
| | 01:05 | amount of disk space that your file
takes up and simultaneously a dramatic
| | 01:09 | increase in the speed at which
your queries and reports take to run.
| | 01:13 | Compacting and repairing your database
is a common maintenance task that you
| | 01:16 | should run periodically to
keep your database in good health.
| | Collapse this transcript |
| Examining database object relationships| 00:00 | When you're working with a large database,
or you need to explore the inner
| | 00:03 | workings of a database that somebody
else created, it's important to understand
| | 00:07 | how all of the objects interrelate.
| | 00:09 | We've seen how you can use the
Relationships map to explore the relationships
| | 00:13 | between multiple tables, but that doesn't
tell you what queries rely on specific
| | 00:17 | tables, or which forms send
data to a certain report.
| | 00:21 | To get a deep dive into the interconnectedness
of all of your objects, we are
| | 00:25 | going to turn to the Object Dependencies
tools on the DATABASE TOOLS ribbon.
| | 00:28 | You can find Object Dependencies here.
| | 00:32 | Go ahead and select it, and if this is
the first time this tool has run, you
| | 00:35 | might be prompted to rebuild the
dependency information on your database.
| | 00:39 | Press OK and Access will analyze all of
your objects to see where they connect.
| | 00:43 | Once that's done, you'll see this
Dependencies pane open up on the right.
| | 00:46 | We can go ahead and click on the edge and
drag open to give ourselves some more room.
| | 00:51 | Now I always get a laugh at the fact
that the two options on the top of the
| | 00:55 | pane are written in first person, objects
that depend on me and objects that I depend on.
| | 01:00 | Me, and I here refer to the currently
selected object, over in your Navigation pane.
| | 01:05 | Choosing objects that depend on me
displays the objects that use the selected
| | 01:09 | object as an input or source.
| | 01:11 | Typically, tables are sources for information
that gets passed into queries and reports.
| | 01:16 | If you change the view to objects that
I depend on, you'll see which objects
| | 01:20 | feed into the selected objects.
| | 01:22 | Usually reports and queries require tables.
| | 01:25 | Let's go through and take a look
at some of these relationships.
| | 01:28 | I am going to scroll down and
choose the Customer Spend query.
| | 01:33 | I'll go back up in changes to objects
that depend on me and then I'll press this
| | 01:37 | Refresh button over here to update the list.
| | 01:40 | I can see that the objects that depend
on the Customer Spend query, is this
| | 01:44 | Customer Spend report.
| | 01:46 | Now what objects does the
Customer Spend query depend on?
| | 01:49 | Well, we can change the Radio button
here, and see that the Customer Spend
| | 01:53 | query requires the Customers table, the Orders
table, the Products table and the States table.
| | 01:59 | Let's take a look at one more.
| | 02:00 | I'll scroll down and I'll take a look
at the Training Department Employees.
| | 02:05 | I'll go back up here to the Object
Dependencies panel and press Refresh.
| | 02:10 | Now I can see that the objects that
I depend on, that is the objects that
| | 02:13 | the form depends on, is the
Employees table and the
| | 02:17 | Employees-TrainingDepartment query.
| | 02:19 | I can switch my button here, and see
that the objects that depend on the
| | 02:23 | Training Department Employees form
is the Navigation Form.
| | 02:27 | Once you have done exploring the
Dependencies, you can simply close the panel by
| | 02:31 | pressing the X in the upper-right-hand corner.
| | 02:33 | As your database grows in size, you'll
have lots of interconnections between all
| | 02:37 | types of objects and if you find yourself
in a position where you need to alter
| | 02:40 | the underlying structure of an object,
say renaming a field on a table, you
| | 02:45 | might want to go through all of your
related objects to ensure that the changes
| | 02:48 | made don't break any functionality down the road.
| | 02:51 | The Object Dependencies tool is a great
one-stop location to reminding yourself
| | 02:55 | where those connections occur.
| | Collapse this transcript |
| Documenting your work| 00:00 | The only thing worse than opening up an
unfamiliar database and realizing that
| | 00:04 | you can't figure out what the creator
was thinking when they put it together,
| | 00:08 | is opening up a database that you yourself
created and not remembering why you
| | 00:11 | did it the way you did.
| | 00:13 | I'm a big proponent of keeping a detailed
documentation trail inside of the database file.
| | 00:18 | Fortunately, Access provides lots of
opportunity for you to leave notes to the
| | 00:22 | next database designer that
has to follow in your footsteps.
| | 00:26 | First, let's go ahead and
open up the Customers table.
| | 00:29 | I'll right-click on it, and
switch directly to Design View.
| | 00:32 | Each field has an Optional Description
area where we can type a note describing
| | 00:36 | the type of data stored.
| | 00:38 | For instance, the two notes we put in earlier.
| | 00:40 | The State is a Two letter state
abbreviation and the EMail is their
| | 00:44 | primary contact e.mail.
| | 00:46 | This Optional Description area is a
great place to store any specific notes on
| | 00:50 | the formatting or requirements of each data field.
| | 00:52 | I'll go ahead and close this table.
| | 00:54 | If you right-click on a Table, or in
fact actually any object in the Navigation
| | 00:58 | pane, you can go into the Properties
for that object down at the very bottom.
| | 01:03 | In the Properties, there is a Description field
where we can type in what
| | 01:07 | this data table is for.
| | 01:08 | I'll type that this table so as
the Customer list for No Obstacles.
| | 01:13 | Go ahead and say OK to save that change.
| | 01:15 | When working with queries, specifically
queries that use a complex calculation
| | 01:19 | or function, it's useful to put a quick
human readable description of what that
| | 01:23 | calculation is doing.
| | 01:24 | I'm going to go ahead and open up
one of our queries that we worked on.
| | 01:28 | I am going to find the Customer Spend query,
right-click on it, and go to Design View.
| | 01:33 | Here at the end, I have got a calculated field,
that's finding customer's total
| | 01:37 | amount that they spent with the company.
| | 01:39 | I am going to put a Comment here.
| | 01:41 | I can right-click on the field and open
up the Property Sheet for that field and
| | 01:45 | here in the Properties, I have got a Description field.
| | 01:47 | Now you can either type here or right-click
there and press Zoom to get a larger
| | 01:52 | window where you can type.
| | 01:54 | Here I am going to type Calculates the
total lifetime spend for each customer by
| | 01:59 | adding up the total transaction price
for all orders placed.
| | 02:03 | Go ahead and press OK to
save that property description.
| | 02:07 | Now it adds up to my Description field,
so anybody who's curious as to what this
| | 02:11 | calculation does, can see it right here.
| | 02:13 | Go ahead and close the Property Sheet
and then we'll close and save the query.
| | 02:17 | Let's scroll down in our Navigation pane.
| | 02:20 | On Forms, we have two useful features
that we can enable to help guide your users.
| | 02:24 | I am going to go ahead and open up the
Training Department Employees table and
| | 02:29 | I'll right-click and go straight to Design View.
| | 02:33 | Now in the top of our Form, I have
got this Search box right up here.
| | 02:36 | Let's add some descriptive helpers for our users.
| | 02:38 | I am going to click on that
and open up the Property Sheet.
| | 02:42 | Now for the properties on that control,
on the Other tab, we have got two
| | 02:46 | properties I want to take a look at.
| | 02:48 | This ControlTip Text will be a little
pop-up flag that will come up when the
| | 02:52 | user hovers over the control.
| | 02:54 | I am going to type here Search:
| | 02:56 | Choose a name, or just start typing.
| | 03:03 | Down a few more lines,
we've got the Status Bar Text.
| | 03:06 | The Status Bar Text will be a little flag
that shows up right down here in this area.
| | 03:10 | Go ahead and type in here
'Jump to a specific Employee'.
| | 03:17 | Let's go ahead and close the Property Sheet
and we'll close and save the form.
| | 03:23 | Now let's try it out. I'll open it up.
| | 03:25 | When I go up to the Search box and
click, you'll see the little pop-up flag
| | 03:29 | here, saying 'Search:
| | 03:30 | Choose a name or just start typing'
and down in the bottom left-hand corner,
| | 03:34 | Jump to a specific employee.
| | 03:36 | Let's go ahead and close this form.
| | 03:38 | When creating a macro object, you can
add a comment field that allows you to
| | 03:42 | describe what the procedure does
or which object it is connected to.
| | 03:45 | I am going to go down to
this disabled macro here.
| | 03:48 | I am going to right-click on
it and jump into Design View.
| | 03:51 | Now we'll go to add a new action.
| | 03:53 | One of the actions that we can is a Comment.
| | 03:56 | If I start typing Comment, you'll see
that pop up and when I press Enter,
| | 04:00 | it gives me a new Comment field.
| | 04:01 | Here, I can say this action runs
when the database starts.
| | 04:06 | Now I can move it up to the very top,
so that anybody, reviewing this macro, can
| | 04:11 | see instantly what it was created for.
| | 04:13 | I'll go ahead and close and save my macro.
| | 04:17 | I personally don't think it's possible
to over-document your work.
| | 04:20 | Adding appropriate comments can aid
someone else down the road help understand
| | 04:24 | the database's structure.
| | 04:25 | And when you need to get up and running
on a new database file quickly, you'll
| | 04:30 | be glad to find that the person that
created it before you, took the time to
| | 04:34 | leave notes behind as well.
| | 04:35 | Taking the time to document what you do
and why is an important piece of being
| | 04:39 | a great database designer.
| | Collapse this transcript |
| Printing the blueprint of your database with the Database Documenter| 00:00 | Occasionally, you may need to provide
a written set of specifications on how
| | 00:04 | your database was created and all of
the details about what makes it tick.
| | 00:08 | A tool, called the Database Documenter, makes
that task as easy as pressing the Print button.
| | 00:12 | You will find it in the Database tools ribbon,
under Database Documenter.
| | 00:18 | Starting the tool brings up a window
that gives you the opportunity to select
| | 00:21 | which objects you'd like to document.
| | 00:23 | We can choose from our Tables, our
Queries, Forms, Reports, Macros, everything
| | 00:30 | in our current database, including the
Properties and Relationships, any Visual
| | 00:34 | Basic modules we might have
or we can choose all object types.
| | 00:38 | I am going to choose a couple of objects
from our Tables and Queries group.
| | 00:41 | Let's choose our Customers table here
and switch to the Queries group and choose
| | 00:47 | our Customers-WestRegion query.
| | 00:50 | We'll go ahead and say OK to run the report.
| | 00:53 | The report opens up in Print Preview mode.
| | 00:55 | You can then click the page to zoom in
or send it to the printer here or export
| | 01:00 | it to a file such as a PDF or an Excel file.
| | 01:04 | Let's see what's in the report now.
I'll scroll up to the top.
| | 01:06 | In the top, we'll have a header which
gives us the date that the report was run.
| | 01:11 | We can also see which file this report was run on.
| | 01:14 | Below, we'll see the properties for this file,
including any coloring or any
| | 01:18 | styling that has been applied.
| | 01:20 | Down below we've got the columns that make
up this table, here is the CustomerID column.
| | 01:25 | It's a Long Integer type, set to 4.
| | 01:28 | We have got some various other properties
about the CustomerID column and
| | 01:31 | then we've got the FirstName column,
that's Short text with a string of 255 characters.
| | 01:36 | Following, got some additional details about that field.
| | 01:40 | Now I can page through this report using the
Report buttons down here at the bottom.
| | 01:43 | We'll scroll through and see all
the different fields that are in
| | 01:46 | this particular table.
| | 01:48 | We can also see the relationships that
have been established between this table
| | 01:51 | and other tables and the
fields that they are linked by.
| | 01:54 | We'll go ahead and scroll down and
I'll keep paging through the document.
| | 01:57 | Eventually, we'll get to the page for the
query that we exported, here it is, Query:
| | 02:01 | Customers-WestRegion.
| | 02:03 | Again, we've got the properties for this query.
| | 02:05 | The SQL statement or this is the programming
code that generates that query, and
| | 02:10 | the various columns that make up that query.
| | 02:12 | Anything you can possibly want to know,
about how this object was built, can be
| | 02:16 | found in the Database Documentation Report.
| | 02:18 | The Database Documenter is a great
tool for generating the blueprint of your
| | 02:22 | database and it's something that can be
printed out or saved as a PDF file in a
| | 02:26 | remote offsite location, just in case
disaster strikes and you need to recreate
| | 02:30 | your database all over again.
| | 02:31 | It can also be a handy report to have
when sharing the construction progress
| | 02:35 | with your colleagues in order to
get valuable input and feedback on the
| | 02:38 | direction that you are taking.
| | Collapse this transcript |
| Splitting a database into front and back ends| 00:00 | If your database will be used by
several people at once, you should
| | 00:03 | consider splitting it.
| | 00:05 | Splitting a database converts it from
one file into two linked files called a
| | 00:09 | Back-end and a Front-end.
| | 00:10 | The Back-end file will contain all of
your data tables and can be stored on a
| | 00:14 | network server so that everybody
has access to the same information.
| | 00:17 | Access provides a tool to easily split
your database into two components and we
| | 00:21 | can find it up on the Database tools tab.
| | 00:23 | Here we are going to go to
the Access Database button.
| | 00:26 | Now even though the name of the button
isn't very descriptive, the icon gives
| | 00:29 | you an idea of what's about to happen.
| | 00:31 | One database will become two parts.
| | 00:34 | Go ahead and click that button.
| | 00:36 | When you do, the Database Splitter Wizard opens.
| | 00:38 | It gives you some instruction
about what's about to happen.
| | 00:41 | When you press the Split Database button,
Access will move all of your data
| | 00:44 | tables into a new file which could be moved
to a commonly shared location on
| | 00:48 | your company's network, for example.
| | 00:50 | The remaining interface objects such as
queries, forms and reports will become,
| | 00:55 | what's called, the Front-end.
| | 00:56 | Each user can keep a copy of the
Front-end file on their local machine.
| | 01:00 | This gives everyone the best of both worlds.
| | 01:02 | When interacting with the database,
running a query or printing your report for
| | 01:06 | instance, the database runs quickly
because it doesn't have to transfer each
| | 01:09 | mouse click over the network, but you
still get the benefit of having everyone
| | 01:13 | share the same data tables.
| | 01:15 | So for example, if somebody in a
different department adds a new vendor,
| | 01:19 | everyone accessing the database, will
instantly be able to make use of that new
| | 01:23 | vendor in their product orders.
| | 01:25 | Go ahead and press the Split Database button
and Access will ask you where to
| | 01:28 | put the Back-end file.
| | 01:30 | Notice that it adds up a 'be'
at the end of the file name.
| | 01:33 | This is a common convention that reminds
you that this is the Back-end file.
| | 01:36 | I am going to go ahead and
save this into my exercise files.
| | 01:39 | Go to the Desktop, into my Exercise folder
and inside of the Chapter 12 (Ch 12) folder.
| | 01:46 | Go ahead and say Split.
| | 01:49 | Access tells us that the split procedure
was completed successfully.
| | 01:53 | Go ahead and say OK to dismiss the wizard.
| | 01:56 | Now if you're looking your Navigation pane,
you'll notice all of our tables
| | 01:59 | have this blue arrow icon next to them,
that indicates that they are now linked tables.
| | 02:03 | And if you hover your mouse over them,
you can confirm that their file location
| | 02:07 | is indeed in that Back-end, _be file.
| | 02:10 | Splitting your database provides an
easy way to give each user their own
| | 02:13 | customized Front-end with Forms,
Queries and Reports specific to their tasks or
| | 02:18 | areas of responsibility.
| | 02:20 | By storing all of the data from those tasks
into a commonly accessed Back-end
| | 02:23 | file, stored in a network location,
everyone in the organization will be
| | 02:27 | pulling from and writing to the same
pool of shared data, so that everybody is
| | 02:32 | always up-to-date.
| | Collapse this transcript |
| Protecting the database with a password| 00:00 | It's common for an Access database to
include sensitive information that should
| | 00:04 | only be accessible to people
with the proper credentials.
| | 00:07 | By establishing a password on your database file,
you can keep your data secure.
| | 00:11 | In order to password-protect our database file,
we are going to go up to
| | 00:14 | the File tab here and in the Info group,
we are going to choose Encrypt with Password.
| | 00:20 | When you do that, you'll get an information box
here that says 'You must have
| | 00:23 | the database open for exclusive use to set
or remove the database password'.
| | 00:27 | Go ahead and say OK.
| | 00:28 | In order to open up our database in exclusive use,
we actually need to close it first.
| | 00:33 | Let me go to the File tab and choose Close Database.
| | 00:37 | Then I'll go to File tab again and say Open.
| | 00:41 | I am going to go into My Computer
and then click the Browse button.
| | 00:46 | I'll find the Exercise File in the Chapter 12
(Ch 12) folder and we are looking
| | 00:51 | for the one called NoObstacles-Password.
| | 00:53 | Go ahead and click on it one time,
but don't double-click on it to open it.
| | 00:57 | I'll select it and then go into this Open button here.
| | 01:00 | On the right half of the button,
you'll see this down arrow.
| | 01:03 | Press that, and we'll get some additional
options for opening our file.
| | 01:06 | One of them is Open Exclusive.
| | 01:09 | Go ahead and choose Open Exclusive
on that database file.
| | 01:12 | Now our database file is opened exclusively,
that means that nobody else can
| | 01:16 | open it at the same time.
| | 01:18 | Now we can go ahead and set our password.
| | 01:20 | Go to the File tab, in the Info group,
Encrypt with Password.
| | 01:25 | Now we can type in our password and go ahead
and verify the password that you just typed in.
| | 01:31 | Press the OK button to set your password.
| | 01:33 | If you get this warning message,
just press OK to dismiss it.
| | 01:37 | Now our database is protected.
| | 01:39 | If I go to file, Close again, and then go
back to the File menu, Open and from
| | 01:46 | my Recent menu I selected here, notice
I'll have to now enter a password before
| | 01:51 | it continues opening the file.
| | 01:53 | I'll go ahead and type in the password
and press OK and now I've gained
| | 01:57 | access to my database.
| | 01:59 | If I want to remove the password from
my database, I'll have to go through the
| | 02:03 | process to set up my file in Exclusive mode again.
| | 02:05 | I'll go back to the File tab, close it,
one more time to the File tab, Open>My
| | 02:12 | Computer and Browse.
| | 02:15 | I'll locate the file again, in my
Exercise folder, in the Chapter 12 (Ch 12)
| | 02:21 | folder, the Password file.
| | 02:24 | I'll use the downward-pointing
arrow and choose Open Exclusive.
| | 02:28 | I'll have to enter in the password again
and now I can go back to File, in
| | 02:35 | the Info section, here is a button to decrypt
the database which will remove the password.
| | 02:40 | Setting a database password is a simple
step that you can take to protect the
| | 02:44 | information and contents of your database.
| | 02:46 | Just make sure that you use a password
you can remember or write it down in
| | 02:49 | a secure location, otherwise you could find
yourself locked out of your own database.
| | Collapse this transcript |
| Creating custom Ribbon tabs| 00:00 | When working in Access you'll soon
find that you have a small group of very
| | 00:04 | commonly used tools that you've
returned to time and time again.
| | 00:07 | Some of these tools are already present
in the ribbons, but some aren't.You can
| | 00:11 | create a Custom Ribbon tab here at the
top using your own set of commonly used
| | 00:15 | commands in order to speed up your work.
| | 00:17 | We can do that by going to the FILE tab
and then clicking Options down at the bottom.
| | 00:22 | From the Access Options window
we're going to choose Customize ribbon.
| | 00:26 | On the left side of this screen we
have a list of all of the commands that we
| | 00:29 | can add and on the right we
have our current Ribbon structure.
| | 00:32 | I'm going to go ahead and add a New Tab
by pressing this button down here that
| | 00:35 | will create this New Tab with
a single Group inside if it.
| | 00:38 | I'll click where it says New Tab (
Custom) and then click the Rename button.
| | 00:42 | I'm going to give this a name No Obstacles.
| | 00:45 | Go ahead and say OK and then I'll
click on the New Group line and I'll rename
| | 00:50 | that as well, I'm going to call
this Favorites, go ahead and say OK.
| | 00:55 | Let's add two additional groups here;
| | 00:57 | I'll say New Group and New Group again.
| | 01:00 | We'll click on the first one and rename
it, this one is going to be our Design a
| | 01:05 | New Object group, I'll say OK.
| | 01:09 | And this group down here, I'll rename it,
that's going to be our Daily Tasks and
| | 01:15 | go ahead and say OK.
| | 01:16 | So now I've got a new
Ribbon with three groups in it.
| | 01:19 | Now it's time to start putting
buttons inside of these groups.
| | 01:21 | I'll click on the Favorites group.
| | 01:23 | And here we're going to put some
buttons that'll quickly change from Form View
| | 01:27 | to Datasheet View to Design View.
| | 01:28 | I'll click on this Datasheet View
button here and say Add, I'll do Design View
| | 01:34 | here and press Add and I'll
find Form View here and press Add.
| | 01:39 | If I want to rearrange the buttons order,
I simply select it here and move it up
| | 01:43 | or down on the list.
| | 01:44 | I'll move Form View to the beginning,
then Datasheet View, the Design View.
| | 01:49 | Next, let's add our button to
our Design a New Object category.
| | 01:52 | Here I want to put buttons that go
straight to Table Design, Query Design, Form
| | 01:56 | Design and Report Design.
| | 01:58 | Now I'm not going to find them here
on this list, but I can change Popular
| | 02:02 | Commands here to All Commands.
| | 02:04 | Then I'll scroll down the list until
I find Table Design towards bottom and
| | 02:08 | there it is here, I'll add this one,
say Add and that will go down into my
| | 02:13 | Design a New Object group.
| | 02:14 | Now we'll go find the others Query
Design, here it is, go ahead and add that
| | 02:20 | over, then Form Design, here it is and
then finally Report Design which is back
| | 02:29 | towards the bottom and
we'll add that over as well.
| | 02:32 | Finally our Daily Tasks, here we could
actually add our buttons to run our Macros.
| | 02:37 | I'll go back up here to Choose
commands from and I'll change it to Macros and
| | 02:41 | from there I'll add our Good Morning
Macro, Add that down to the list here and
| | 02:45 | I can even change its icon by
pressing on the Rename button here, that will
| | 02:49 | bring up this list where I can give it
a new name if I'd like and I'll choose
| | 02:53 | an icon from this list.
| | 02:54 | I like this push pin icon
there, go ahead and say OK.
| | 02:58 | Now if I wanted to move this Ribbon
tab to the end of the list, I'll click on
| | 03:02 | where it says No Obstacles here and
I'll scroll down and press the down key
| | 03:05 | until it gets all the way down to the bottom.
| | 03:08 | Now it will appear at the
end of the list of tabs.
| | 03:11 | Let's go ahead and test it out, I'll
say OK here and we'll see our new No
| | 03:15 | Obstacle tab here at the top.
| | 03:17 | If I click on it, you'll see all my
Favorites, my Design a New Object and in
| | 03:21 | fact a link to my macro.
| | 03:22 | I'll press Good Morning and there are
the three objects ready to get started at
| | 03:26 | the beginning of the day.
| | 03:27 | Creating a customized Ribbon tab with
all of the tools that you use regularly
| | 03:31 | can speed up your work by placing
them all in one convenient location.
| | Collapse this transcript |
| Setting startup options and custom icons| 00:00 | To give your database a polished appearance,
consider setting some of
| | 00:03 | the Startup Options.
| | 00:04 | Let's take a look at what's available
by going to the FILE tab here and
| | 00:08 | going down to Options.
| | 00:09 | That will open up the Access Options window
and I'll choose Current Database.
| | 00:13 | The first option is this Application Title.
| | 00:16 | That will be what appears here
at the very top of your screen.
| | 00:18 | I'm going to change it to say No Obstacles.
| | 00:21 | I can specify a custom Application Icon
that will replace what shows up here in
| | 00:26 | the top left corner.
| | 00:27 | I'll choose my Browse button, go out to
my Exercise folder, it's on Desktop in
| | 00:31 | the Ch 12 folder and here I have our
RecycleBug logo saved as an icon file.
| | 00:36 | I'll go ahead and say on OK
and that will add its path here.
| | 00:40 | I can choose to display a Form
when the database opens.
| | 00:43 | This drop down will show me all
of the form objects in my database.
| | 00:46 | I am going to choose our Navigation Form.
| | 00:49 | I can choose to Display the Status Bar or not.
| | 00:51 | The Status Bar is what appears
down here at the bottom.
| | 00:53 | I also have options for how my windows open.
| | 00:57 | Tabbed Documents is the default that
opens up every object as tab that appears
| | 01:01 | across the line here.
| | 01:03 | The other option is Overlapping Windows that
will make everything float on top of each other;
| | 01:08 | I'll leave it as Tabbed Documents.
| | 01:09 | We've got some options down
below here, Enable Layout View.
| | 01:14 | If I like to only use the design tools
to create my objects I can disable
| | 01:18 | Layout View altogether.
| | 01:19 | And I also have an option here to
Enable design changes for tables in Datasheet View.
| | 01:24 | This can protect the structure by requiring
all changes be made in the full Design mode.
| | 01:29 | I'm going to turn both of those off.
| | 01:31 | Down here I have an option
for Display Navigation Pane.
| | 01:34 | If I turn that off, Access will hide
the Navigation Pane from VIEW when
| | 01:37 | the database starts.
| | 01:39 | Let me scroll down a little bit further.
| | 01:41 | If you really want to keep people from
getting into your database structure, you
| | 01:45 | can turn off Allow Full menus;
| | 01:47 | this will only leave the HOME tab and
any Custom tabs that you may have created
| | 01:51 | and the Print Preview Ribbon
tabs available for people to use.
| | 01:54 | Of course, if I turn this option off
and the Navigation Pane option off, this
| | 01:58 | will require that your database is
structured in a way that all of your required
| | 02:01 | task can be accomplished through the
use of well organized forms, navigation
| | 02:05 | controls buttons and macros
to move from object to object.
| | 02:09 | But if that's the case, turning off the
Navigation Pane on the Ribbons can keep
| | 02:13 | other users away from objects
that they shouldn't be adjusting.
| | 02:16 | Once you've made all of your selections, go
ahead and press OK down here at the bottom.
| | 02:20 | Now Access will tell me that I need to
close and reopen the database for the
| | 02:24 | options to take effect.
| | 02:25 | Go ahead and say OK and you can go to
the FILE tab and Close and then once again
| | 02:30 | FILE>Open, from my Recent menu,
I'll click Startup here.
| | 02:35 | Notice that a bunch of things are a little bit different.
| | 02:37 | First I've got my Title up here at the top,
I've got my logo over here on the
| | 02:40 | left, I'm missing most of my tabs except
for the HOME tab, my Navigation Form
| | 02:46 | opened up and my Navigation Pane
is completely hidden.
| | 02:49 | Now I should point out that the
Navigation Pane isn't completely gone, you can
| | 02:52 | bring it back by pressing F11 keyboard shortcut key.
| | 02:55 | Now we can bypass all of the Startup Options
by holding down the Shift key when
| | 03:00 | we open our database.
| | 03:01 | I'll go ahead and close everything down
by going to the FILE tab and then pressing Exit.
| | 03:05 | And then I'll go back out to my file
by clicking on it here, I'll hold the Shift
| | 03:09 | key down while I double-click on the fileto open it
and all of my Startup Options get bypassed.
| | 03:14 | Notice that Environment is reset back to
the way it was before I changed those options.
| | 03:18 | Once your database is fully developed
and its time to get down to the day-to-day
| | 03:22 | management of your data, entering
records and printing reports, it's a good idea
| | 03:26 | to limit the amount of exposure
you give to the design tools.
| | 03:29 | They'll still be there when you want to
make structural changes to the database,
| | 03:32 | but they're really not required
for general operational tasks.
| | 03:35 | It's safer if you keep them off the screen
to keep everyone, including yourself,
| | 03:39 | from accidentally breaking something
that you've worked so hard to perfect.
| | Collapse this transcript |
|
|
ConclusionNext steps| 00:00 | I want to thank you for joining me as
we got to know Microsoft Access 2013.
| | 00:05 | If you would like to expand on
your knowledge, let me make the
| | 00:08 | following suggestions.
| | 00:09 | At the beginning of this course, I mentioned
that the templates that come with
| | 00:12 | Access are a great resource
for further exploration.
| | 00:14 | I'm going to reiterate that point again
and encourage you to go through and
| | 00:18 | download some of the templates to explore.
| | 00:21 | Really dig into them and see how they function.
| | 00:24 | Take some time and review their table
structure and their relationships, then
| | 00:27 | run a few queries, see what their results
are and switch into Design View to see
| | 00:31 | how it was constructed.
| | 00:33 | Deconstruct the forms and reports in
Layout and Design Views and don't forget to
| | 00:37 | peruse the Property Sheets for
all the details on each object.
| | 00:39 | You'll be surprised that how much
you can quickly pick up by seeing other
| | 00:43 | databases at work.
| | 00:45 | If you want to dig even deeper, lynda.com
offers courses on Visual Basic and
| | 00:49 | Structured Query Language in
addition to in-depth courses on Access.
| | 00:52 | We're always adding new and updated
content, so check back regularly to see
| | 00:56 | what's new in the world of database design.
| | 00:59 | I hope you've enjoyed your time exploring
the ins and outs of Microsoft Access 2013.
| | 01:04 | Until next time, have a great day!
| | Collapse this transcript |
|
|