navigate site menu

Start learning with our library of video tutorials taught by experts. Get started

Access 2007 Essential Training

Access 2007 Essential Training

with David Rivers

 


From using predefined Access 2007 database applications to building them from scratch, Access 2007 Essential Training covers each step of understanding, creating, and modifying databases for custom business purposes. Instructor David Rivers shows even the most database-challenged how to utilize this powerful software for creating reports and charts, as well as for business record keeping and analysis. Exercise files accompany the tutorials.

show more

author
David Rivers
subject
Business, Databases
software
Access 2007
level
Beginner
duration
5h 26m
released
Oct 10, 2007

Share this course

Ready to join? get started


Keep up with news, tips, and latest courses.

submit Course details submit clicked more info

Please wait...

Search the closed captioning text for this course by entering the keyword you’d like to search, or browse the closed captioning text by selecting the chapter name below and choosing the video title you’d like to review.



Introduction
Welcome
00:00Hi and welcome to Microsoft Access 2007. I'm David Rivers.
00:04When it comes to creating and using databases on your desktop computer,
00:09Microsoft Access is the industry standard.
00:11Access is part of certain Microsoft Office Suite products but not all.
00:15You'll need Microsoft Office Professional, Ultimate, or Enterprise to get
00:19Access, along with all the regulars like Word, Excel, and PowerPoint.
00:23In this title we'll begin with a good foundation covering important database
00:27concepts and terminology before moving into the application itself.
00:31Once inside Access 2007 and feeling comfortable in our new environment,
00:35we'll work through a common scenario as we create a relational database made up of
00:39tables, queries, forms, reports and more.
00:44Let's get started.
Collapse this transcript
1. Getting Started with Access
Database concepts and terminology
00:00Right before we get into Microsoft Access 2007, get familiar with the
00:05environment, and start creating, we need to cover some database concepts.
00:09So let's talk about a database and exactly what it is.
00:12In its simplest terms, a database is an organized collection of information and
00:17we use organized collections of information every day.
00:20Take for example a telephone book, or a recipe book, or even a mailing list.
00:23Now in Microsoft Access a database is a little bit more than that.
00:27Yes, it is a set of data related to specific purposes or topics, but it also
00:33includes tools that you need to work with that data, such as tools for sorting
00:37and extracting data or even summarizing it in a nice little report.
00:41Another piece of terminology that you need to be familiar with when working in
00:44Microsoft Access is a table.
00:46Now a table is just a list of related information that's sorted into columns and rows.
00:51Now each row in the table would be called a record.
00:54Think of the phone book and your particular information in that phone book would
00:57be considered a record.
00:59Each column in the table would be called a category, or in our case, a field.
01:03Now a column of phone numbers in that phone book would be considered the phone
01:07number field, for example.
01:09Now your actual phone number in the phonebook is one item of data, and we
01:13called that a data value.
01:16Now let's talk about relational database concepts, because when we work with
01:19Microsoft Access we're creating what we call a relational database, and a
01:23relational database is not a flat file database, like a phone book or even a
01:28spreadsheet for example.
01:30Just think of a mail-order DVD club for a minute and take a look at this first
01:34table here where we've got the name of a person placing the order, we've got
01:37their information like address, city, state, zip.
01:39Then we've got an order number for their order, the date it was ordered, there's
01:44the DVD title and the price.
01:46Now what if a customer orders more than one DVD?
01:49Well as a business we hope that would happen, but what then happens in a flat
01:52file like this is we get multiple records containing duplicate information.
01:56So take a look at this table now, where we see David Rivers four times, the
02:01address is repeated four times, so is the city, state, and zip.
02:05The order numbers change, but down here, you can see that we've got the same
02:09order number because the same DVD was ordered twice, maybe one for oneself
02:14then one as a gift.
02:15So here we've got a very inefficient design.
02:19In Microsoft Access when we talk about relational databases, we mean multiple
02:23tables and each table will pertain to a specific topic.
02:26So look at this example here where I've got all the customers and their
02:30information in one table separate from all of the orders that go into their own
02:35table, and then we've got a DVD Inventory table here that has all the DVD
02:39titles and the prices.
02:40All we need to do now is simply add some fields to each of these tables that
02:44will contain data that uniquely identifies each record, and when we talk about a
02:50unique identifier, we're talking about the primary key field.
02:54Now the primary key is a field containing unique data values to identify
02:58each record in a table.
03:00So if you look down here at the Customers table, we've added the Customer ID field.
03:04Over here, we've got the Order Number field, and in the DVD Inventory, each DVD
03:09will get an ID that is unique.
03:11So in other words we will not have two Customer IDs in the Customer tables that are the same.
03:16In the Orders table each order will have its own unique number, and same thing
03:20for the DVD Inventory table where each DVD has its own unique identifier.
03:26So because each of these tables is linked by a common field, and you can see
03:30going from Customers over to Orders, we've got the Customer ID field in here,
03:34and then from the DVD Inventory table we've got the DVD ID showing up in the
03:38Orders table as well.
03:40This makes them related or will be called a relational database.
03:44Now relationships need to be explained a little bit too because each
03:47relationship will consist of a primary table, sometimes called the parent, and a
03:51related table that we often call the child.
03:54The primary table usually contains the primary key fields.
03:57So over here we've got Customers table with the Customer ID as the primary key,
04:02and over here in the Orders table you see Customer ID does show up, but it's
04:05not a primary key and that means that this Customer ID can show up many times
04:10in the Orders table.
04:11That's exactly what we want.
04:13We want the same customer placing many orders.
04:17Now when we talk about relationships, that's how tables are related, there's
04:21another key concept you need to understand.
04:23Typical relationships include one-to-one and one-to-many.
04:27Those are the two main types of relationships.
04:29A one-to-one relationship exists when the primary record has only one related
04:34record in that child or related table.
04:37So here you can see we've got customer information and their address and then
04:41we've got a billing table for example, where a billing address would show up for
04:44each customer, and they're only allowed one billing address, so you can see
04:48we've got the primary key here showing up in both tables.
04:52Now, the one-to-many relationship is actually the more related records in the related table.
04:56So here you can see where we've got Customers listed in our Customers table, the
05:01Customer ID exists only once in this table, and that's because Customer ID is
05:06the primary key, but we do see that same Customer ID repeated many times in the
05:10Orders table as the customer places each order.
05:14Notice also that the Customer ID here is not a primary key, not in the Orders table.
05:20So now we need to understand something called normalization.
05:23We need to be able to organize our data into smaller tables.
05:27And that's part of normalization, and the reason we do that is to
05:30prevent redundant data.
05:31We saw that earlier where a name and addresses and so on were
05:34repeated throughout a table.
05:36By separating them into separate tables we avoid that redundancy.
05:39That improves our manageability of our database, improves the speed and
05:43efficiency that we can work with the data, and then it makes creating or
05:47designing queries, forms, and reports that much easier.
05:50You'll see this when we get in to Microsoft Access.
05:53So the things we need to do in normalization is determine how many tables
05:57we're going to need, determine what fields we're going to need, and then focus
06:01in on that primary key.
06:03There's actually five forms of normalization, but we're going to talk about the
06:06main three, that usually allow us to achieve normalization.
06:10Database design theory includes standards and guidelines, and they're
06:13called normal forms.
06:14to help us create a normalized database.
06:17So once primary keys are determined, normalization can start to take affect.
06:22There are five normal forms, like I mentioned, and they have to be created in
06:27order, or performed in order, but most databases like I said achieve
06:30normalization after the third normal form.
06:33So that's what we're going to focus on:
06:34normal forms 1 through 3.
06:36So normal form one here, is where we break each field down to its
06:39smallest meaningful value.
06:41You can see in this table here where I've got a Customer ID, I've got
06:44names, addresses, etc.
06:45Well in the Name field I've got a first and a last name.
06:48In the address I've got the street, the city, the state.
06:50This is the same information in a table that's been broken down into those
06:55smallest meaningful values in separate fields.
06:58Here you can see I've got a first name and a last name.
07:00The address has the street address, the city, the state and zip, and look down
07:04here where we've got family members.
07:06We've got separate fields for Spouse, Child 1 and Child 2.
07:09One of these records has blank fields, so here's someone with no dependants.
07:14So we'll keep that in mind as we move into the next step in normal form 1.
07:19We want to remove repeating groups of data and create a separate table for each
07:23set of the related data.
07:24So those dependants for example, if we separate them from one table into
07:28their own table, you can see we can just refer to the Customer ID and keep
07:32track of their dependants.
07:33For example, if this person here, Customer ID 433, Dave Rivers, was to add a new
07:39dependant, there wouldn't be room in the original table, but over here in this
07:43table, we simply add another record 433 and the name of the dependant.
07:46It also means that we don't have any blanks like we saw in the previous table.
07:51So that's the next step in normalization.
07:54Then we get to normal form 2, and here's where we create new tables for data
07:58that applies to more than one record in a table and we add a related field,
08:02that's called a foreign key, to the new tables.
08:04So here's that example again, where we've got customers and then over here you
08:09can see they belong to a store and the stores each have their own ID, so all we
08:13need to do is put in a store ID.
08:15Normal form 3 is where we remove fields that do not relate to or provide a fact
08:20about the primary keys.
08:21So in a table, you look at that primary key, if you see fields that don't
08:24actually relate to the primary key, you can put them off in their own tables and
08:28link those tables through a common field.
08:30So take a look at this example here where we've got Customers and then the Store
08:34Code is in the Stores table, and there's the link from Store Code here to Store
08:39Code over here, and then Dependants, we saw that in the earlier example where
08:44the Customer ID is related to its various dependants.
08:47So here you can see the types of relationships we're talking about.
08:51In the Customers table, Customer ID is the primary key, so it will always be unique.
08:55That means we've got a one-to-many relationship.
08:58In the Dependants table we'll see that customer ID repeated many times, for
09:02every order, for example, or for each dependant as they're added.
09:06Also down here, you can see Stores.
09:08The Store Code is going to exist once only in the Stores table, but we'll see
09:13the Stores Codes showing up with the various customers repeated many times in
09:17the Customers table, so there's the one-to-many relationship.
09:21So the 1 and then the infinity symbol represents the many.
09:24All right let's talk about a real-life scenario that we're going to use as we go
09:28into Microsoft Access and use some of these concepts and create our own database
09:33or relational database.
09:35Let's say we currently own several albums on CD, tape and vinyl, and we want to
09:39get those organized so it's easy to find songs or albums.
09:42We also want to be able the search by media, genre, the artist, the year or the
09:47decade, and maybe apply a ranking that we can use to look up songs and albums.
09:51Maybe we want to be able to search for albums based on a star rating as well, so
09:56our favorite albums.
09:57And we want able to add new albums of course, at any time as we acquire new CDs tapes etc.
10:03So that's what we're going to do in Microsoft Access.
10:06Let's move on to launching the actual program.
Collapse this transcript
Starting Access
00:00It's time now to load Microsoft Access 2007 and get acquainted with our new environment.
00:06Before we can start creating tables and queries, reports and forms, and so on we
00:10need to be comfortable in our new environment, and if you're brand-new to
00:14version 2007 of Microsoft Access, you'll see some changes.
00:17Now I'm using Windows Vista, so when I come down to the bottom left-hand corner
00:21my Start button looks like this.
00:23In Windows XP the Start button is in the same location, but it has the word Start on it.
00:27We're going to give that a click.
00:29Now in Vista, I get a list of recently used applications.
00:32You can see them all listed here, one of them happens to be Microsoft Access 2007.
00:35So if I was to click this I would launch the application, but I'm going to
00:40pretend that's not there.
00:42The very first time you use Access, it will not be on this list.
00:45So down at the bottom here where it says Start Search I can click and start
00:49typing in the work Access and look what happens.
00:52I just typed acc and you can see what's happening, Microsoft Access shows
00:56up right at the top. Perfect.
00:57I can launch it from here.
00:59I've got some other programs listed here that either have Access in the name or
01:03are related to Access.
01:05Then I've got files as well down below, with access in the name or Access files. Kind of neat.
01:11Makes it really easy to find your applications and launch them.
01:14Now let's just pretend we don't have Windows Vista.
01:16We're working in XP.
01:18We come down to the Start button, just like XP in Vista we have All Programs.
01:23I can just hover over that without clicking it to get a list of all of my options.
01:27Now at the top of this list, and I'm going to scroll up, you can see
01:30actual applications.
01:32These are actual programs I can launch right from here.
01:34As I scroll a little further down I'm going to see the one I'm looking for,
01:38which is Microsoft Office.
01:39Clicking Microsoft Office is going to expand that to show me all of the
01:43applications in that folder, and right at the top is Microsoft Access 2007.
01:46So I'm going to give that a click.
01:49All right so we're into Microsoft Access now and you will be greeted with this
01:55seemed Getting Started screen that you see in front of you here, but before we
01:58go into detail on the Getting Started screen, I want to get you familiar with
02:02your environment here, so going up to the very top left corner, you'll see I've
02:06got the Office button, and the Office button is very familiar to people who are
02:11accustomed to using the File menu in previous versions.
02:15When I click the Office button, you'll see some file related commands like New,
02:19Open, there's some Save buttons, Print, Manage, E-mail, Publish, and there's
02:25where I go to close a database once I've got one open.
02:27Right now many of these buttons are not accessible because I don't have anything
02:31open to work with yet.
02:32I also have a list of recently used documents, which happen to be databases in this case.
02:38You can see them listed here and I can also access, no pun intended, my Access
02:43options down here by clicking the Access Options button.
02:46We'll talk about that later as well.
02:48Here's another way to exit Access if I'm done with it.
02:52I'm not going to select anything from here, so I'm going to click outside the
02:54menu to disable it, and go back up to the top left corner cause we've got
02:58something here, called the Quick Accesss toolbar.
03:00This is new to Office 2007.
03:03The Quick Access toolbar is going to have a number of commands that you use most often.
03:08Now in this case, you can see I've got a Save, Undo, and Redo buttons showing
03:12up here by default, but we can totally customize this and we will do that a
03:16little bit later on.
03:18So we'll get all of the commands that you're accustomed to using on a regular
03:21basis, or most frequently, and we'll put them up here.
03:25Now across the title bar where we see Microsoft Access, on the right hand side,
03:28we've got some buttons that should look familiar to you.
03:31The minimize button, so if we want to keep Access running and just minimize it,
03:35that throws it down on our taskbar.
03:37If I come back down to the bottom on my screen, it's still running.
03:39I can give it a click to resume where I left off.
03:43Over here, because Access currently fills my entire screen. It's maximized.
03:48This is a Restore Down button.
03:50When I click it you can see that the window is restored down to a default size.
03:54Now this size might not be the best size to work in, so we can maximize, now the
03:59middle button is a Maximize button to fill the entire screen.
04:03That's how I like to work personally.
04:05The Close button is in the top right corner. It's red.
04:08This will close the application, the same as going to the Office button and
04:11choosing to Exit Access.
04:13Right below that is our Help button.
04:15So any time you see this little circle with a ? inside, that's your Help button
04:20and F1 on the keyboard is the shortcut.
04:23So we can access Microsoft Office Help as well as Microsoft Office Access
04:28Help and all of the help that appears online as well, if you're connected to the Internet.
04:33All right in the middle section here is our Getting Started area.
04:37We're going to talk about that in the next lesson in great detail, so let's move
04:40down to the bottom where we have our status bar.
04:43Status bar gives you information as you work on the various objects in Microsoft
04:47Access, and right now you'll see that our status is Ready.
04:50So it's very important that we look down here when we're working on certain
04:54portions of Microsoft Access, because we'll get messages down here telling us
04:58whether or not we're allowed to save something or move on.
05:01Always check down on the status bar to get the latest status.
05:04All right so those are the basics of our environment.
05:07In the next lesson we're going to go into great detail talking about this
05:10Getting Started screen you see in front of you here.
Collapse this transcript
The Getting Started window
00:00In the previous lesson we launched Microsoft Access from the Start button in
00:04Windows, and this is how we were greeted with the Getting Started with Microsoft
00:08Office Access screen.
00:09You'll always see the Getting Started screen here every time you launch Access.
00:13The only time that you won't is if you create a database and then create a
00:16shortcut to that database that you can double-click directly from the
00:19Desktop, for example.
00:21So going directly to a database you've already created will bypass this screen,
00:25but every time you go right to the Access icon, either through the Start button
00:28or double-clicking it on the Desktop for example, you'll be greeted by this
00:32Getting Started screen.
00:33So we need to get familiar with this cause it will help you get started the
00:36first time using Access 2007.
00:37Now you can see there's three sections here.
00:40Over on the left I've got Template Categories.
00:43In the middle I see Getting Started with Microsoft Office Access, and I will see
00:47whatever is selected over here down the middle, and then on the right hand side.
00:51I've got an opportunity to either open an existing database or one of the most
00:55recently used databases in Access.
00:58So let's talk about these sections quickly.
01:00Over here on the left you can see Featuring is selected, and because it's
01:04selected here under Template Categories, if I go over to the middle section
01:07under Getting Started yes, I can create a new blank database from scratch.
01:12It won't contain any objects, won't contain any tables or forms or reports, or
01:17down below you'll see I've got Featured Online Templates, and that's because
01:21Featuring is selected over here on the left.
01:23Now all of these, for example Assets, Contacts, Issues, etc., are online
01:29templates that I can access if I'm connected to the Internet.
01:32What that does is it gives me a great head start.
01:34If I wanted to compile a list of my contacts and their information, I can click
01:38Contacts here, create a new database that will have tables with the proper
01:42fields for me to use already created.
01:44In other words, it's going to save me a ton of work.
01:47Now, if I'm not connected to the Internet, no problem.
01:50I'm going to come over here and click Local Templates, and you can see when I do
01:53that I get a number of the same categories here like Assets and Contacts and so
01:58on, but all of these templates are actually stored locally on my hard drive.
02:02So I can access them, get a nice jump start creating my own database by using
02:07one of these templates.
02:09Now over here on the left under From Microsoft Office Online, again we're
02:12talking about being connected to the Internet, cause when I come over here to
02:16Business, I'm going to see a bunch of business templates that I can access from
02:20Microsoft Office Online.
02:21So Assets is there, Contacts is there, there's Issues and Events, but there's a
02:25whole bunch of other ones we didn't see earlier, like Business account ledger,
02:29there's a Call tracker database.
02:31Look down here at a Lending library, I like that one.
02:34So clicking any of these will actually borrow the template from a location
02:38that's online at Microsoft and get me started creating my own database,
02:42using some of the objects that would be used in for example, a Lending
02:46library here selected.
02:47Under Education, I've got a number of other ones.
02:50I've got Faculty and Students.
02:52Under Personal if I want to create any of my own personal databases like a Home
02:57inventory, a Lending library, there it is again, Personal contact manager,
03:01Nutrition that's a neat one.
03:03So lots of opportunity here to get a jumpstart in Microsoft Access.
03:07I don't have to create the database from scratch.
03:10I've got tons of templates.
03:11I've even got a sample database here.
03:13When I open this up, I'll see all of the tables, the reports, the forms, etc.
03:17that comprise this database, and that'll help me learn how to create my own.
03:21I'm going to go back up to Featuring where we started.
03:25Now like I said we can create a new blank database without using a template,
03:29that means we're creating all of our tables and every field in the table, every
03:33form, every report from scratch.
03:36On the right now, once we've created a database here's where we go to open it up.
03:39Now I can go to my Office button up here and choose Open, that's one way.
03:44Notice also I've got Recent Documents listed here, which are recent databases,
03:48and it's the same list as I see over here on the right-hand side.
03:51So this just another way to open an existing database.
03:54If it's one that I've worked with recently, it'll show up on this list.
03:57If you haven't created one yet, your list will be empty, but clicking More,
04:02right up here, will allow me to go browsing through my hard drive, network
04:05drives, etc., to find an existing database.
04:08Clicking it and choosing Open will bring it up on my screen.
04:11I'm going to click Cancel.
04:14So that's the Getting Started screen.
04:16Again, if you're new to Microsoft Access, it's a great way to get rolling.
04:19If you want to use some of the templates and you're connected to the Internet,
04:22you've got a huge opportunity here.
04:25If you're not connected to the internet, no problem.
04:27There are a number of local templates stored on your hard drive with the
04:31installation to help get you started.
04:33Next we're going to look at how we actually modify what we see up here in the
04:37top left corner on our Quick Access toolbar.
Collapse this transcript
The Quick Access toolbar
00:00Now that we're familiar with the Getting Started screen that greets you every
00:03time you launch Access, it's time to get a little more familiar with the Quick
00:07Access toolbar up here in the top left corner because you'll probably end up
00:11using it quite a bit.
00:12Now by default, you can see up here I've only got three buttons showing up on my
00:16Quick Access toolbar:
00:17the Save button, Undo, and Redo.
00:20Right now I can't use any of them, because I don't actually have a database open
00:24to save, and I haven't done anything yet that I can undo, and of course if I
00:28haven't undone anything there's nothing to redo.
00:30So, how do I get some more buttons showing up there?
00:33For example, I like to do a Print Preview on a regular basis.
00:36How do I get that up there?
00:37Well, you'll notice just to the right of the last button I've got a little drop
00:40down and when I click that, you'll see a number of commands showing up, commonly
00:45used commands like New, Open, E-mail.
00:48There are some Quick Prints and Print Preview options, Spelling.
00:51The ones that are already checked off are the ones that show up on the
00:54Quick Access toolbar.
00:56So if Quick Print is something that I use a lot, I'm going to give it a click
00:59and you'll see that that button now appears on my Quick Access toolbar.
01:04Now what if I also like to export to an Excel spreadsheet on a regular basis.
01:08It would be nice to have a shortcut button up here, so I don't have to go
01:11through the Office button and finding it.
01:13I'm going to click the drop-down, and I'm going to come down to More Commands,
01:17and here's where I can see pretty much everything.
01:19Not only can I see additional commands, but here's where I can go to reorder the
01:24way that the buttons appear on my Quick Access toolbar.
01:26So the first thing I'm going to do is add Export to Excel spreadsheet, by
01:30clicking it and then clicking the Add button to move it over, and now you can
01:34see that they show up in the order that they're added.
01:37Now Quick Print, I want next to Save, so I'm going to click on Quick Print, and
01:41I'm going to bump it up twice, so it's next to Save.
01:43Then I've got Undo, Redo, and Export to Excel spreadsheet. That's perfect.
01:49So right now I'm looking at a list of popular commands down here, and you can
01:53see it's a partial list.
01:55If I click this drop down, you can see I've got all kinds of other choices,
01:59Commands that are not in the Ribbon, Macros.
02:02Under the Office menu, you can see I've got Print Preview, Home, Create, etc.
02:07Then I've got a whole bunch down here for forms, relationships, lots and lots of options here.
02:15Now each one of those is a category that contains its own commands.
02:18So if I wanted for example Macro commands, clicking on Macros will show me if I've got any.
02:23A list of Macro commands down below, like a separator here for example.
02:27If I go back up here to All Commands, I'm going to see every possible
02:32command, and there's a lot.
02:35You can see, as I scroll down, there's tons and tons of commands.
02:38So if there's one that you like to use over and over and over again, you'll find
02:42it on this list, you'll add it to your Quick Access toolbar, and when you come
02:46down here and click OK, you'll see your updated Quick Access toolbar.
02:51So here you can see now I've got Save, there's my Quick Print, Undo, Redo, and
02:55my Export to Excel button.
02:57Now if I go back to this drop down there's something else you need to know about.
03:00We can change the location of our Quick Access toolbar.
03:04If you don't like it up there in the top left corner you can also show it Below the Ribbon.
03:08Now, right now we're not seeing the ribbon because we haven't actually opened up
03:11a database yet and we will get into the ribbon in detail in an upcoming lesson,
03:16but if you don't like it up there at the top, you can move it below the ribbon
03:19where it's a little bit easier to access.
03:21For example, we're going to leave it right where it is, but just so you know,
03:24you can move it by clicking Show Below the Ribbon.
03:28I'm not going to select from there.
03:29I'm going to click off of the menu to deselect it and leave my Quick Access
03:33toolbar just the way I see it here.
03:35You can see there's lots of room up here on the title bar to add more and more
03:39buttons if you so choose.
03:41Keep in mind, it's a great way to access some of the more commonly used
03:45commands, customizing it to exactly the way you use Access.
Collapse this transcript
Opening an existing Access database
00:00Very shortly you're going to be creating your own database.
00:03So once you've done that, how do you open it up?
00:05Also, we need to get familiar with the Access environment, past the Getting
00:08Started screen here.
00:10So we'll need to open up an existing database to do that.
00:13That's what we're going to do now and there's a couple of different ways to open
00:16up a database that already exists.
00:18One way is the Office button.
00:20If you're accustomed to using other applications like Microsoft Word or Excel
00:24for example, you know you can click the Office button, come down to the Open
00:28button and give it a click, Control+O on the keyboard is the shortcut, and then
00:32navigate to the Lesson1 folder of your Exercise Files.
00:35You'll find Personal Inventory there.
00:37Clicking that, and then clicking Open will bring it up on the screen.
00:40All right, so here's my Home Inventory list that's somewhat started.
00:45I'm going to close that by going back to the Office button, and I'm going to
00:49come down to Close Database.
00:51I don't want to go up to the red x in the top right corner, cause that will
00:54close Access altogether.
00:56Another way to open up an existing database is from over here on the right hand
01:00side of the Getting Started screen under Open Recent Database.
01:04Now I can come right here to this top one, that's the one I most recently used;
01:08my Personal Inventory.
01:09Click it once and again, it opens it up for me.
01:12I'm going to close that down one more time, and show you a couple other ways.
01:18Now, if the database does not show up on your most recently used list of
01:23databases, you can click More.
01:26Again you would navigate to your Exercise Files, go to the Lesson1 folder by
01:32double-clicking and find Personal Inventory and click Open.
01:36I'm going to click Cancel.
01:37That's three different ways to open up an existing database, but I want to
01:41show you another option.
01:42I'm going to minimize Access, keep it running but just minimize it, and come to my Desktop.
01:47Here, I can create a shortcut to the actual database and bypass that Getting
01:51Started screen we saw earlier.
01:53So by right-clicking here in the Desktop, and coming down to New and selecting
01:58Shortcut, I can now browse to that database file by clicking the Browse button,
02:04and I need to go up to my Desktop here, down to Exercise Files, I'm going to go
02:10into my Lesson1 folder, and there it is:
02:12Personal Inventory.
02:13So when I click on it and I click OK, all I have to do is hit the Next button
02:18now to see the name that's going to show up and I can change that if I want.
02:22Personal Inventory's good;
02:23I'm going to leave that there and click Finish.
02:26Now I've got a shortcut to my actual database.
02:29So I don't have to launch Access.
02:31I can go right in here, I can double- click Personal Inventory, it will launch
02:34Access and take me directly to my database called Personal Inventory.
02:40So there you have a few different ways to open up an existing database.
02:44Next we're going to get used to and familiarize ourselves with this
02:47new environment.
Collapse this transcript
The work environment
00:00So we now have a database open from the previous lesson.
00:03You can see the name of it up here on the title bar:
00:05Personal Inventory.
00:06It's an Access 2007 database.
00:09We open it up from the Lesson1 folder of the Exercise Files and because we've
00:13got this open in Access 2007, there are some new things in this environment we
00:18need to talk about before we move on and start creating your own.
00:22First of all across the top we've got something now called the Ribbon, and
00:25there's actually four tabs up here for Home, Create, External Data and Database Tools.
00:32Each one of those is a separate ribbon on its own.
00:34The ribbon contains sections with a number of commands that are most
00:38frequently used and the tools you need when you need them will show up
00:43depending on what you're working on.
00:44In other words, the ribbon is context sensitive.
00:47So if I come down below here and I'm looking at the Home Inventory List form,
00:52the form has buttons for creating new assets, collecting data, e-mailing, etc.
00:57I'm going to click right here inside one of these fields.
01:00As soon as I did, a number of tools became accessible to me.
01:04I'm going to talk about the different tabs in the ribbon, and the different
01:07sections down below.
01:08Currently on the Home tab you'll see I've got a View section, the Views drop
01:12down to look at Forms, Layout, and Design Views.
01:18Over here I've got a Clipboard section, and here's where I would go to
01:22Cut, Copy, and Paste.
01:23Right now none of these buttons is accessible.
01:25If I were to click and drag over Office Desk, for example, you'll see now that
01:30the Cut and Copy buttons are available to me.
01:32Next we've got the Font section.
01:34The Font section contains all of the font commands.
01:37With this highlighted text I may want to change the font, the size, the
01:41alignment, the appearance with bold, italics, underline, the color.
01:46I can even work with the grid lines, if I wanted to.
01:49Another thing I want you to know is that any time you see a group with a
01:52little arrow on the bottom right-hand corner, it means we can open it up to show even more.
01:56So I'm going to click this under Font.
01:58You can see I've got Datasheet Formatting showing up now.
02:01So I can do cell effects.
02:03There's my grid line options again.
02:05I can do background colors.
02:07I can do gridline colors, all kinds of cool things on top of these font
02:12options that you see here.
02:13I'm going to click Cancel.
02:15So just keep in mind every time you see one of these little guys in the bottom
02:18right corner, there's more that you can bring up that's related to that section.
02:23There's a Rich Text section here for working with numbered and bulleted lists,
02:27indenting and that kind of thing.
02:29In the Records section you can see I can refresh my records.
02:33I can create new records.
02:34So if I had a new inventory item that had to go on my list, I could use the New button.
02:39That's one way of creating a new item.
02:41Here's where I can save my records, delete records, total up records, there's a
02:46spelling option and more.
02:48I've got a sort and filter option for sorting the data that you see here.
02:52I can sort it alphabetically.
02:55You can see ascending or descending, and I can choose which of these fields I want to sort by.
03:00I've also got a filtering option, so I can only see the stuff I want to see.
03:04There's a Wizard button here.
03:05Any time you see the little lightning bolt, you'll know there's a Wizard built
03:08into that to help you create the filter.
03:11I've got a find section that includes Find and Replace options, Go To as well.
03:16And I've got other tabs.
03:17I've got a Create tab up here.
03:20Now clicking the Create tab's going to show me, guess what?
03:22A number of create options, and what can I create?
03:26I can create Tables, Forms, Reports, and over in the other section I can create
03:32Queries and Macros, all from this ribbon.
03:34So if I want to create a table from scratch, I can come up here, a new blank table.
03:39If I want to base it on an existing template, I can use table templates.
03:43If I want to use SharePoint services I can go here, and if I want to adjust the
03:47design of any table I do create I can go to the Table Design view.
03:52Same goes for Forms.
03:53There are three different form looks to choose from.
03:55Here is a Basic Form, a Split Form, and Multiple Items type forms.
04:00Here's my Blank Form from scratch.
04:02More forms appear down here and there's a design button for working with
04:06form design as well.
04:08Same goes for reports:
04:09creating Reports, blank ones.
04:11There's a Report Wizard to help me, and look at that, another design button.
04:16Same goes for creating queries.
04:18There's a Query Design button, and we also have the ability to create macros to automate tasks.
04:23We'll look at all of this stuff later on.
04:25The External Data tab, guess what?
04:28We can work with data outside of Access.
04:30We can import or export that data.
04:33If we import on a regular basis from another Access database, an Excel
04:37spreadsheet, a SharePoint service, a text file, whatever.
04:40If we do that over and over and over again, we may want to save that import and automate that.
04:45The same goes for exporting data to Excel spreadsheets, or Word files, or text files.
04:51If we do that on a regular basis, we may want to save those exports as well.
04:55There's a Collect Data section for working with e-mails and managing replies,
04:59and then there's a whole SharePoint section, which is fairly advanced and we'll
05:02save that for another title.
05:04Up at the top we've got one last tab, the Database Tools tab.
05:07It shows us the database tools ribbon.
05:09You can see we've got a Macro section in here for running macros and if you're a
05:13programmer, you'll know all about Visual Basic.
05:14There's a Show/Hide section for showing and hiding relationships and
05:19object dependencies.
05:20We'll talk about that later on too.
05:22Analyzing our database is important, with the Database Documenter.
05:26We can analyze the performance of our database to make sure it's working at its upmost peak.
05:31You can see, we can analyze tables as well, within our database.
05:34Moving data is important.
05:35Using SQL Servers and Access Databases.
05:38And then we've got Database Tools over here, like creating security options
05:42using encryption and passwords, a Switchboard Manager as well.
05:45We'll look at those later on in this title too.
05:48I'm going to go back to the Home tab now, and just keep in mind that depending
05:52on what we're working on down below, this ribbon is always changing, always
05:56offering up the tools we need at our fingertips when we need them.
06:00Down the left-hand side we've got a Navigation pane as well, and you'll notice
06:03there's a double arrow at the top, this is our Shutter Bar to open and close our
06:08Navigation Pane, or we can click right on the Navigation Pane here, when it
06:12lights up to show the Navigation Pane.
06:14Now this is for our Home Inventory, and you can see that this is based on the
06:18Assets template, so I see below by default couple of different forms, like
06:23Home Inventory list.
06:25That's the form I'm looking at right now over here on the right, but if I
06:28want to look at a different kind of form, Asset Details, I could double-click right here.
06:33This opens up the Asset Details form.
06:35It's the same information that I can look at or enter, but it's a different way of doing it.
06:41You can see down at the bottom here on that record 1 of 5 and I can move through
06:45the various records.
06:46I can move to the end, or to the beginning, and if I want to input a new record
06:51there's a button for that as well.
06:53I'm going to close this up for now.
06:54I can click the Close button up here or choose Close right down here, and it's
06:58always available to me in the Navigation Pane.
07:01The Navigation Pane's going to allow me to move quickly and easily through the
07:04various objects in my database.
07:06So when we have multiple tables and different forms, and we have all kinds
07:09of queries and reports, a quick way to get around them is using this Navigation Pane.
07:15Now, if you look down below, these icons are little bit different.
07:17These little green ones represent reports.
07:20So if I want to look at my Assets by Category, I could double-click here,
07:24it opens up a report for me showing the graphical representation as well as
07:29the details down below.
07:31Another thing happened here as well.
07:33The Assets by Category tab just showed up.
07:36So another way to close up something you've opened up is to right-click its tab
07:40and choose Close from here.
07:41All right, same goes for these other reports like Asset Details, Assets by
07:47Location, double-clicking will launch it.
07:49It gives you a tab so you can move quickly and easily between the various
07:53objects, and when you're done you can either click the Close button or
07:57right-click and choose Close.
07:59Now you'll notice that we've got the Assets section here showing us different
08:04reports and forms, but we've also got Supporting Objects.
08:07So what's in behind the scenes allowing us to use these forms and reports?
08:12Well if we click this little drop down here we'll expand this section to show a table.
08:17There's an Assets table.
08:18Now if I double-click that you can see now we're looking at the actual table
08:22where this information is either entered or comes from.
08:25And again we've got a tab.
08:27I can right-click and close that when I'm done, and I've got two more forms down here.
08:31If I want to work with the Assets by Categories or by location, I can do that to.
08:36I can change the names of these obviously to my Inventory by Categories or
08:40Inventory by Location Chart.
08:42We're going to talk about working with forms and reports and tables and
08:46everything in upcoming lessons.
08:48So right now I just want you to get familiar with the Navigation Pane;
08:51how to use it, when we're done looking at a section we can collapse it like so.
08:55When we're done with the Navigation Pane, we can minimize it or close it up
08:59right here and you'll see that it's always available to us down the left-hand
09:03side, and we're going to get into greater detail with the Navigation Pane later
09:07on when we start using it, and using it to navigate through the various tables
09:11and forms and reports.
09:12There are different ways to sort what you see there as well.
09:16But hopefully this gives you a nice overview of the new work environment using Access 2007.
09:21Keep in mind the ribbon gives you the tools you need when you need them.
09:24It's context-sensitive and the Navigation Pane is always at your fingertips down
09:28the left-hand side here, to make it easy for you to go between the objects in
09:32your database, like tables and forms and reports.
Collapse this transcript
Customizing the Access environment
00:00I promise you we're very close now to actually designing your own database
00:04and creating the objects in that database, like tables and forms, queries and
00:08reports, but just before we do I want to bring your attention to the Access Options.
00:14You have full control over how your Microsoft Access application works, and
00:19you can access those options by going up to the top left corner and clicking
00:22the Office button and coming down to the very bottom, where you'll find Access Options.
00:27Give that a click.
00:27All right, right now for me Customize is selected.
00:31Yours may be something else, but click on Customize, cause under Customize
00:35you're going to see something familiar to you if you went through a previous
00:38lesson where we talked about the Quick Access toolbar.
00:41This is the exact same information for adding and removing and reordering the
00:46buttons that appear on your Quick Access toolbar.
00:49Here are the actual commands or buttons that now appear on my Quick Access
00:52toolbar in this order, but if I wanted to add any I can go to any one of these
00:57commands, which falls under the Popular Commands category and just simply Add,
01:02click to Add, or with it selected, Remove.
01:07Now if I wanted to just select from different groups of commands, I can come
01:10down here, or if I want to see them all, I can choose All Commands, and I get
01:15a full alphabetical listing of absolutely every command that can go on my
01:19Quick Access toolbar.
01:21But we covered this already in a previous lesson, so we're going to move on, and
01:25we're going to start at the top here of our list under Popular.
01:28As soon as we click Popular, you can see here's where we go to change the most
01:31popular options in Access.
01:33For example ClearType.
01:35ClearType is an option that smoothes out fonts and makes them look sharper and
01:40crisper on our screen.
01:41It takes a little more resources out of your computer so with it always
01:45turned on like this, you know you can speed up performance if you wanted to
01:48buy deselecting it.
01:49So any of these options can be turned on or off including the color scheme and
01:54ScreenTips for example.
01:56When we're creating databases you can see the default file format, and this is
01:59an important one, is set to Access 2007 by default.
02:03This is a new format that users of previous versions of Access will not be able
02:08to open up your files, unless they have Access 2007.
02:11So if you do share with others you may want to change your default to
02:15something else like Access 2002, 2003 for example, or even go all the way back to Access 2000.
02:21I'm going to leave it at 2007, and I know that this format's fine for me
02:26because I won't be sharing, at least I won't be sharing with anyone who's got
02:30an older version of Access.
02:31The default database folder where my database files are stored is My Documents.
02:36You can see it right here under Documents.
02:38I can change that using the Browse button.
02:40The New database sort order is set to General, and there's all kinds of
02:44languages to choose from down here, but we'll leave it at General.
02:48And we can also personalize our copy of Office, of Microsoft Office.
02:52This applies to all of the applications in Microsoft Office, not just Access.
02:56So the User name David Rivers, and the initials DR will be attached to the files
03:00I save in any of the Office applications.
03:03All right, let's go to Current Database and here we're going to see options for
03:08the current database, that's the one I have open right now, which is my personal
03:11inventory database, and you can see the display form that comes up is my home
03:15inventory list by default.
03:17The status bar is displayed.
03:18There's all kinds of options for working with this database.
03:21There's a Navigation section.
03:23The Navigation Pane is enabled, so I can see it here.
03:26The Ribbon is also enabled.
03:29AutoCorrect options for name tracking in there as well.
03:33We won't go into detail on every single option, but just so you know where to go
03:36to make those changes.
03:38I'll go to Datasheet now.
03:39Customize the way datasheets look in Access by changing their font colors,
03:43background colors, gridlines.
03:45You can see cell effects down here.
03:47The default font that I'm using is this one, Calibri, it's at size 11 points,
03:52but I can change that if I wanted to.
03:55Even the appearance using underlining and italics.
03:58I'm not going to make any changes here.
04:00I'm going to move on to Object Designers.
04:02So in Table design, Query design, and Forms design you can see, we've also got
04:07down at the bottom Error checking, all kinds of options to work with when we're
04:11designing any of these items.
04:14The one that's important that I want to draw your attention to is under Table design.
04:18The default field unless we choose something different is a text field
04:22containing 255 characters max.
04:26So we could change that if we use a lot a numeric fields, for example.
04:29You could change it to Number, but you can see there's all kinds of different
04:33field types to choose from, but if the most common one's going to be text I'm
04:37going to leave it at Text.
04:39We've also got some Proofing options.
04:40This is important, especially AutoCorrect options, if you like them or don't like them.
04:45There are some that I like and don't like and this is where I go to turn them
04:49on or turn them off.
04:50Ignore words in uppercase is turned on and Ignore words that contain numbers is
04:55important when working with a database because you may have fields that are
04:59combinations of characters and numbers.
05:01We don't want them automatically corrected or to appear as spelling mistakes.
05:05We're ignoring Internet and file addresses as well.
05:08So obviously www.Lynda.com is not in any dictionary, but it appears like an
05:14Internet address, so it won't show up as a spelling mistake.
05:17Flag repeated words is turned on, that's kind of important.
05:21Under the AutoCorrect Options, you can click here to get a whole bunch more and
05:26you can turn any of those off that annoy you by clicking this button.
05:29For example two initial capitals, capitalize names of days is turned on, if you
05:35don't like that, correct accidental use of caps lock key, I do like that one,
05:39and you can see down below a whole list of items that will be replaced with
05:44something different.
05:46So of course you can add to this and you can turn off or remove any of these as well.
05:52So this all applies to any of the applications in the Office Suite, not just Access.
05:56Any changes you make are carried through the entire Suite.
05:59There is an Advanced section, and you can see we've got some Editing options
06:05that can be turned on and off, Display, Printing look at the margins for
06:10printing if you don't like those you can change them.
06:13So I encourage you to go through all of these categories and see if there are
06:16things that you tend to get annoyed by and turn them off or if there are things
06:20you feel are missing, turn them on.
06:22There's an Add-ins, a Trust Center and, a Resources tab as well.
06:27So I'm going to click Cancel down below.
06:29I haven't made any changes.
06:30I don't want to make any changes.
06:32I'm going to accept the defaults as we go through this title but it was very
06:35important for me to let you know that from the Office button you can access the
06:40Microsoft Access options by clicking this button to change any of your work
06:44environment settings.
Collapse this transcript
2. Creating Databases and Tables
Planning and designing databases
00:00All right gang, it's design time.
00:02It's time for us to design our relational database.
00:06Like I mentioned in a previous lesson, up to 70% of the effort that goes into
00:11designing and creating a relational database in Microsoft Access happens before
00:16you even get into the software.
00:17So literally on paper you want to figure out what goes into this database.
00:22Why am I creating it?
00:23What's the reason and what's going to be the outcome?
00:26So normally people don't just sit down when they're bored and say hey, I think
00:30I'll create a relational database today.
00:32Usually there's a reason.
00:33There's something that needs to be accomplished, maybe an issue that needs to be resolved.
00:38Using our real-life scenario, we need to identify the issue of having a
00:42disorganized music collection.
00:45So what we have is hundreds of albums, some of them are in vinyl, we've got a
00:49bunch on tape, a whole bunch on CD, and there's no order to them.
00:53They're disorganized stored in various places, on racks, in boxes, and what we
00:58need to be able to do is find a specific album quickly and right now it's taking
01:02too long searching through all these things.
01:04It takes forever for us to find a specific song that might be on one of those albums.
01:09And other things that we'd like to be able to accomplish might be let's say
01:12someone wants to find all the songs by a specific artist.
01:15Maybe it's all the songs in a time period, or by genre.
01:19Maybe you're having a dinner party and you want to bring out a bunch of jazz music for example.
01:23Well you want to be able to go through your collection and find it, and then
01:27have it ready to go during that dinner party.
01:30What else we'd like to be able to do is to easily add new albums as they come in.
01:35So when we get a new CD for example, we want to be ale to pop this in
01:39easily, fast into our new database so that it's there the next time we need to access it.
01:46Now using this scenario, you can take any scenario out there, whether it's
01:50personal or professional.
01:52Take for example a person who has a medical practice, they would use a database
01:57to keep track of their patients for example., and in their patient records would
02:02be all kinds of information that gets stored with those patients.
02:06Or maybe you're running a business where you're selling goods and you've got an inventory.
02:10You'll want to do the exact same thing that we're doing here organizing our
02:14music collection, except you'll be organizing different items in an inventory.
02:19So once we've decided what the issue is and what we want to resolve here, the
02:24next step is actually identify what the fields are going to be, the pieces of
02:29information we want stored about each album in our case, each song, each artist, and so on.
02:35We're going to look at that next.
Collapse this transcript
Working with fields
00:00So we've now determined what the issue is we've got:
00:03our disorganized collection of music information.
00:06It's in different locations, in boxes and on racks.
00:09It's in different media, it's on CDs, some on vinyls, some are on tapes.
00:15We've got it all scattered around and very disorganized.
00:17When we go to find a specific artist or a specific type of music it's very
00:22difficult to round it all up.
00:24So we've decided we're going to create a relational database that's going to
00:27contain all of our music in a library, make it easy for us to find specific
00:32pieces of information, such as if we have a party that's got an 80's theme for
00:37example, we want to be able to round up all of our 80s music.
00:41Well to do that we need to figure out now what fields we need to create in what
00:46tables, so that we can get the information in first of all, that's called data
00:51entry, but then make it easy to pull that information out.
00:55So let's determine the Fields now that belong in our database.
00:59In our music library we know that all of our albums have titles, so there's
01:03going to be an album title.
01:05We also know that each of the albums has an artist.
01:08Now some of the albums may have various artists, so the Artist field in the
01:12Album table might be able to include an actual name of an artist or it
01:16might just be various.
01:17Keep that in mind when we talk about songs.
01:20We'd like to be able to track the year that the album was created, even the decade.
01:25That's handy because if it was done in 82 and another CD that we have was done
01:30in 89 and we want to be able to pull out all the 80s music, we want to be able
01:34to get a nice report on all of the albums that were done in the 80s.
01:39The media, in other words is it on CD, is it on vinyl, is it on tape.
01:43And why is that handy?
01:44Well maybe we're asked how many songs do you have on vinyl?
01:48How many albums do you have that are on CD?
01:51It would be easy to pull up that information.
01:53How about the location? Is it on a rack?
01:56Is it in a box?
01:57When we use a Location field, we'll be able to find our CDs, our vinyl records,
02:02our tapes quickly and easily.
02:04Of course there's going to be some manual work on the other side of our
02:07database, which is to actually mark up the racks and the boxes and label them properly.
02:12How about Genre?
02:14We want to be able to find all the jazz music that we have, all of the rock
02:18music, the songs themselves, we need to be able to the narrow it down to a
02:23specific song, if we want.
02:24Give me all the songs by the group Boston, for example.
02:28So that means that we're going to have some other information that's pertaining
02:32to an album, the actual songs on that album.
02:35How about the condition?
02:37That might be important.
02:38Is it in good condition?
02:40Is it in bad condition?
02:41We might want to be able to track that.
02:43As well as a rating, maybe we want to be able to give three stars to our
02:47favorites, one star to our least favorites and maybe two stars for right in the middle.
02:52We don't care either way.
02:54So these are the fields, and right now they're just scattered about still very
02:57disorganized, but we've got a good handle now on what we need to track.
03:01Now keep in mind this is not etched in stone.
03:04When we create our tables using these fields, and we realize a little bit later
03:08on, hey we're missing some information here.
03:10It's easy to add a field to a table later on.
03:13We'll look at that when we get to modifying your table design after it's been created.
03:18But we still do need to get organized.
03:20We need to take these pieces of information that we're going to be tracking, the
03:24various fields here, and put them into the separate tables that are going make
03:28it nice and organized for us, and of course remembering the three normal forms
03:32that we talked about.
03:34We want to keep normalization in mind too.
03:37So when we get organized, we see that we might have five different tables, an
03:42Album table, a table with just songs in it, another one with the various
03:46locations, another one for the genre and another one for the media.
03:53So in the Album table, for example we'd see things like the album title, the
03:56artist, the year that the album came out, the decade, as well would be good in there.
04:01Our rating system would be good.
04:03It relates to the album itself as does the condition.
04:07Now in the Songs table, each of the song titles from an album will show up in
04:11the Songs table, as well as the artist.
04:13Now you'll notice we've got Artist here twice.
04:15We've got it in the Album table and in the Songs table.
04:18Remember that we could have CDs or records or tapes that have various artists.
04:24So the album title might be Sound Explosion, the artist in the Album table would
04:29be various and then the individual songs in the Songs table would have their own
04:33actual artist singing that song.
04:36The Locations table will have at least one field for the location.
04:40Of course we're going to need additional fields in each of these tables when we
04:43start to talk about joining them together or relating them. The Genres.
04:48We'll have a genre field in there and the media as well will be kept separate.
04:53We can join these all together into one big happy family when we start talking
04:58about the primary and foreign keys a little bit later on.
05:02So we've kind of narrowed it down to the fields we want and now we've organized
05:07it into the various tables.
05:09We're still working on paper here.
05:11The very next step now is going to be talking about those keys:
05:14the primary and the foreign keys.
05:16So which is the field that will be considered the primary key?
05:20Is it there already, or do we need to add a field?
05:23And then in the related table, the foreign key that matches up the two tables.
05:27So that's what we're going to talk about next.
Collapse this transcript
Choosing keys
00:00As we get closer now to creating and defining the actual tables that will appear
00:05in our relational database, along with actual fields that will appear in each of
00:09those tables, we need to think back now to a topic we discussed in a previous
00:14lesson, and that's normalization.
00:16So we've broken down the fields into their smallest forms, we've separated them
00:20into tables to avoid redundancies, and now we need to think about how we're
00:24going to relate these tables one to another.
00:27As you recall, we talked about primary keys and foreign keys.
00:32So if we look over here at the very far left of our Album table, we need a
00:36field in here that will uniquely identify our albums, so maybe an Album ID for example.
00:43And then to relate the albums to the songs, we might need to see that Album ID
00:48somewhere in the Songs table.
00:50That becomes the foreign key, and as we think about it, we've got Locations,
00:54we've got Genres, and we've got Media.
00:57Well as I think about the various albums, they can only be stored in
01:00one location at a time.
01:02So maybe we don't need a Locations table and the Location field can go back
01:06in the Album table.
01:08Same thing for Media.
01:09Genre really applies to the various songs, so maybe that field belongs in the
01:13Songs table, but we're missing something here.
01:16We notice that we've got the Artist field here in the Album table, and we've got
01:21the Artist field here in the Songs table.
01:23Think about and album that has various artists on it.
01:26The answer in this field will be various, while over here for the specific
01:31songs, it will have actual performers.
01:33So we can't have the same field here named the same thing.
01:37We'll change that to Performer and then we might need a table listing all of
01:42our performers that will be linked to the Songs table, and that's how I came up
01:45with this next image.
01:47Here you can see we've got our Album with the Album ID in bold with the asterix
01:52indicating this is our primary key.
01:54So we'll never have duplicate albums showing up.
01:57This is the unique identifier for each of our albums:
02:00the title, the artist, again that could be various or it could be a group or it
02:05could be an individual.
02:06We're going to rate these:
02:07the condition it's in, where it's located and what type of media it's on.
02:13As we go over to the Songs table now you see we've got a Song Title, and instead
02:17of a Performer we've got a Performer ID, because we've now got this Performers
02:21table, which will have a Performer ID.
02:23each performer will have a First Name and a Last Name and an ID or a unique identifier.
02:28That's the primary key in this table.
02:30So you can see that it shows up over here in the Songs table, as does the Album ID.
02:35So from here over to here we've got a connection and it looks kind of like this:
02:40one unique identifier in the Album table and this album may appear many times
02:45in the Songs table.
02:47And then we've got the same thing going from Performers ID over to our Songs
02:51table, and again that's a one-to-many relationship.
02:55Each of the songs now will have a genre, and a year, and a decade, and then all
03:00of this information is linked together as if it were in one big table but it's
03:05very easy to manipulate having separated it out.
03:09So now we've got what looks like could be our final product.
03:12Keep in mind we can tweak this again, once we get into Microsoft Access and
03:17start building our tables and inserting our fields.
03:20Filling those records up with actual data we may decide we're missing some information.
03:25Yes, we can modify the database design at any time and we will do that a
03:30little bit later on.
03:31But next, it's time to get into Microsoft Access, start creating our tables and
03:36our fields, and inputting data into our records.
Collapse this transcript
Creating tables
00:00Foundation of any database is the data itself.
00:04Data is stored in tables.
00:06So you can't have a database in Microsoft Access without having at least one table.
00:11We've already gone through the design process and figured out what tables we're
00:15going to need and what fields we're going to need in each of those tables.
00:18So now it's time to get in, create our database, and create our first table.
00:23Now the very first time you launch Microsoft Access, you get the Getting Started
00:27screen that we talked about earlier.
00:29And you can see I can create a Blank Database right from this icon here.
00:34Now another option if you're not looking at the Getting Started screen right
00:37now is to go up to the Office button and click New and that will accomplish the exact same thing.
00:42You'll create a new blank database from scratch, and as you create your first
00:47database, the first table in that database is automatically started for you as well.
00:53Now, of course you can if you wanted to start a database from a template.
00:58So when we get into the Getting Started screen here, we're automatically looking
01:02at the Featured Online Templates below our New Blank Database icon.
01:06And if we want to look at our local templates, we can do that by clicking Local,
01:09and you can see we've got different templates for Assets, one for Contacts,
01:15Events, Faculty, and so on.
01:17Now, each of these templates is not just a simple database with one table.
01:21There may be many tables, there may be some reports built-in, and even some sample forms.
01:26So if you wanted to get a great head start on creating a project like we're
01:30going to do with our music library, Assets would probably be the one to start with.
01:35But then you'd have to go in, and you'd have to tweak each of those tables to
01:39have the fields you need for your music library.
01:42So what we're going to do is actually just creating new blank database from
01:46scratch by going up to the Office button and selecting New.
01:49Now, as soon as we do that, you can see we are back to the original
01:53Getting Started screen.
01:54But over here on the right-hand side, we have Blank Database.
01:58Here's where we go to create a Microsoft Office Access database that does not
02:01contain any existing data or objects.
02:04Remember, objects are reports, forms, tables, and so on.
02:09You can see by default it's going to be called Database1, and you can see
02:14exactly where it's going to be saved in the Documents folder.
02:17So that's my default.
02:19Of course, if I want to change the location, I could, by clicking the little
02:22Folder icon over here, and browsing to a location where I want to save this new database.
02:29I'm going to click Cancel, and just leave it as my Documents folder here.
02:35The name, I'm going to change from Database1 to something more meaningful.
02:38So I'm going to highlight Database1, and I'm going to type-in Music Library like so.
02:46Now when I click Create, I'm going to create my first database.
02:50You can see all there is, is one table in here that's started.
02:53There aren't any fields actually except for this ID field and it's now time for
02:58me to look back at my design documents and figure out what fields need to go
03:02into this very first table, and of course, I'll give this table a name.
03:07That's what we're going to do next.
Collapse this transcript
Creating fields
00:00In previous lesson, we created a new blank database, and that's why we have the
00:04screen that we see here in front of us.
00:06If you're jumping into this lesson, you might want to go back to the previous
00:09lesson and just get caught up with us here.
00:11It's very quick and easy.
00:12When we create a new blank database something different in Access happens that
00:17you might not be used to when using other applications.
00:20We had to give our database a name before we actually create it.
00:23So we see that name up here;
00:25it's Music Library, and that's on the title bar and the other thing we did by
00:29default was accepted the brand-new format, which is Access 2007 database format.
00:34Now keep in mind that this format is not compatible with previous versions of
00:38Access, but we were feeling safe with that and we accepted the default format.
00:42Another thing that happened by default is a brand-new table is created for us.
00:48By default it's named Table 1 until we save it, give it a new name, and you can
00:52see it's waiting for us here to add new fields to this table.
00:57So we obviously can't have a database without having a table and some data in
01:01it and that's why this happens by default when we launch a brand-new blank database.
01:06One other thing happened up here on the ribbon you might have noticed is we've
01:09got a new tab, and it's called Datasheet.
01:11You see Table Tools shows up just above it, and we've got a number of
01:15table tools or related commands to working with tables, because that's
01:19what we're doing right now;
01:20creating a brand-new table.
01:22We've got the Views button, Fields & Columns.
01:25There's commands related to working with fields and the columns in our table.
01:29We've got another section here for choosing data types and formatting our fields.
01:34We're going to get into that shortly.
01:35We even have a Relationship section that we're going to talk about a little bit
01:38later on in this title.
01:40So right now let's get back to creating our brand-new table.
01:43Of course we're going to go back to our design process that we did on paper.
01:47Take a look at the tables we need, create our first table, and select the fields
01:52that are going to go in here.
01:53Well you can see it says Add New Field and right now it's waiting for actual data.
01:57So if we wanted to rename this actual field from Add New Field to something
02:01different, it's pretty easy.
02:03We just right-click up here and we go down to Rename Column.
02:06So our first column we actually want to call the Album Title.
02:11I'm going to type in Album Title, and when I hit Enter, you can see
02:17automatically a new column is created for me where I can insert another new
02:21column name, and this is the field, so we're going to go down to Artist.
02:25This is all from our paper design. The next one:
02:29Rating.
02:29And we're going to put in Condition.
02:34The Location of the album.
02:37Each time I'm pressing Enter to move on to the next.
02:40And the Media that it's stored on.
02:42Okay, so we don't need this extra column, so when I hit Enter it's waiting for
02:46me to type in a name, but I don't need that.
02:48Over here where it says ID I'm going to right-click, and I'm going to
02:52rename this column.
02:54I'm just going to add a little bit to it.
02:55This going to be our Album ID, and I'm going to hit Enter. So there we go.
03:03Now it's waiting for us to actually enter some data.
03:07So a new Album ID, the Title, Artist, etc ., but before I start doing that I want
03:12to think about what's going in to each of these fields and you can see by
03:16default, if I look up here under DataType & Formatting, and with my Album ID
03:21highlighted, the Data Type by default is set to AutoNumber.
03:25So if I want the numbers to show up here automatically as I add new albums just
03:29to number them for me, I know that I'm not going to get any duplicates.
03:33So every Album ID is going to be unique, which is what I need, and then I can
03:37just start entering the rest of the data without worrying about choosing numbers
03:41to show up for my ID.
03:43I'm going to leave it at AutoNumber.
03:45Take a look at some of the other options it could be:
03:47Text and Memo fields, which allows me to put in more text than a text field, it
03:53could be numeric, where I could enter numbers.
03:56Keep in mind when you put in numbers, they're usually numbers that you're going
03:59to use in a calculation as opposed to things like phone numbers or ID numbers.
04:04It could be dates and times.
04:06It could be money, currency.
04:08It could be a logical field, which is a yes or a no.
04:10It could be a Hyperlink.
04:12So we're going to leave it at AutoNumber and the other thing that's important is
04:15that because it's going to be our primary key it has to be unique.
04:19We want this checked off over here, which is the Unique box. Is it required?
04:24Well yes it is, but we don't need to check that off because it's a primary key.
04:27So every one of our records is going to have something in that field.
04:31The other formatting buttons relate to the actual numbers that might go in
04:35there, but we're going to leave it just as is.
04:37It's now time to see this, you know we haven't entered any records, you might be
04:41a good idea to save what we've done so far.
04:43I'm going to go up to my Quick Access tool, that's short for going to the Office
04:47button, and choosing Save from there, and I'm going to click the Save button and
04:50you can see by default the name Table 1 does show up, but of course I want to
04:54call this something different.
04:55This is my Album table.
04:57And when I click OK or press Enter, I now have a brand-new table called Album.
05:03I see it over here in the list of all my tables.
05:06There's just the one right now and I'm ready to start inputting data.
05:10So our very first step is complete.
05:12We've created our brand-new table and now we've entered each of the fields
05:16that will appear in this table, we've chosen our primary key, we've even
05:20chosen some formatting, we can go through the rest of these fields deciding on their formatting.
05:25Look what happens when I click on each of these columns.
05:27You can see the default Data Type that is assigned to them.
05:30The Album Title is by default a text field.
05:33It's not going to be unique, but it is required so I'm going to check this box.
05:38The Artist is also text, should be required.
05:42A Rating is by default text, and you can see, I'm going to click the drop-down
05:47here and I'm going to change that to a number.
05:49So I'm going to have a number rating, and I'm not going to do anything
05:53else, it's not unique.
05:54It's not required but it is going to be a number.
05:57The Condition, text field.
06:01Location, Media, and of course we don't need any more fields other than that.
06:07So I think we've got everything set up.
06:09Again another Save.
06:10It's going to save or update our changes if we've made any.
06:14Notice that only the first time are we prompted for the name of the table, from
06:17then on we're just updating the existing table.
06:20So we're ready now to start inputting some actual data, that is entering data
06:25into each of these fields.
06:26We're going to do that next.
Collapse this transcript
Working with records
00:00Data entry can be very tedious.
00:02It's simply putting data into the fields that we've created in this table.
00:06Now without data, obviously we don't have a database, so it's extremely
00:10important even though it can be very mind-numbing.
00:13What we're going to do here is create some records.
00:15Every time we enter information into a row in this particular view called the
00:20datasheet view we're creating a record.
00:22Now you can see right now that the Album ID is the currently selected column or field.
00:28I'm going to ensure that I'm clicking on the Datasheet tab up here.
00:31I want everyone to see the Datasheet options on the ribbon, and we know that the
00:35Album ID is automatically going to be numbered for us because the Data Type up
00:39here shows up as AutoNumber.
00:41So all I need to do is just tab across like I would a table in Microsoft Word or
00:46the cells in an Excel spreadsheet enter my data.
00:49So I'm going to tab over to the Album Title.
00:52Now this is currently a new record until I type my first character here.
00:56Watch what happens.
00:57I'm going to type in Boston.
00:58As soon as I do, this Album ID number shows up, number 1, and the new record now
01:04is bumped down below.
01:06I'm going to hit my Tab key to move over to Artist.
01:08This is a self-titled album, so Boston is also the artist.
01:12It's one of my faves.
01:14I'm not going to give it a five star rating, but I'm going to put a four in there.
01:17This is on vinyl, and the condition is good.
01:20It could be better, but it's good.
01:22It's located on Rack 2.
01:25So I've got a few racks and this is on rack number two.
01:28The Media, as I mentioned is a vinyl, so I'm going to type that in and when I
01:33hit Tab look what happens.
01:34It moves down to the next record, the next row waiting to automatically
01:38number my next record.
01:40So all I do is hit Tab to move on to the next one.
01:42So this one's called Rock Classics.
01:46Same thing happens, a new record is pushed down below, and this becomes record number 2.
01:51The Artist on this one is various.
01:54This rating is going to be a 3.
01:56The condition is excellent. Why?
01:59Because it's on CD.
02:00And that's on Rack 1.
02:04And I'm going to hit Tab and look what happens.
02:06Each time I hit Tab I'm creating new records.
02:09Let's just do another one.
02:11This one's called Live! Live!
02:15with an exclamation mark. Live!
02:16Now you can see that this is taking up more space than I have in this column.
02:21We're going to talk about formatting your fields a little bit later on.
02:26This one's by Bryan Adams. I love this one.
02:31I'm going to put it in as a 5.
02:32Unfortunately, the condition is poor because it's on a tape, which is on Rack number 3.
02:40And I'm done, so I've entered my first three records.
02:43Now as I enter those records and as I Tab from field to field they're actually
02:47being saved in the table.
02:49Yes, I can go up and save at any time, but just so you know records are
02:52being saved on the fly.
02:54Let's add one more just for fun, so we have something to edit a little bit later on.
03:01Tuesday Night Music Club.
03:07This one's by Sheryl Crow.
03:10Rating, I'm going to put it at a 4.
03:13Excellent condition. This is a CD.
03:19I put it on Rack 3. The type is CD.
03:22Excellent.
03:23I hit Tab to lock in that new record.
03:25All right so what happens if we need to go back and make a change?
03:29I just noticed I put that on the wrong rack.
03:32All my CDs are on rack number one.
03:34So I'm going to come up in here and I can just with my mouse click inside any of
03:37these fields and edit.
03:38So I'm going to take that 3 out and put in a 1.
03:42As I hit Tab, you can see I'm moving through the various fields in the various records.
03:49Let's add another one.
03:49I'm going to type in Boston, Boston.
03:55I'm going to put in a Rating of 4. Good.
03:59You can see what's happening here.
04:01I don't realize, but I've already got this one in here.
04:05So when I hit Tab and create this new record, I realize, hey wait a second I've
04:09got a record in here that I don't want.
04:12So the common mistake that people will make, is they'll come in here and perhaps
04:17click on the left-hand side here to highlight the entire row and then they'll
04:21come up here and try to hit Delete.
04:23When really if you look at the name of this group, it's fields and columns.
04:27We would use this Delete command here for deleting fields.
04:30The actual column, not the actual records.
04:33So look what happens when we hit our Delete key on the keyboard.
04:37You are about to delete 1 record, if you click Yes, you won't be able to
04:41undo this delete operation, so you have to be sure that you meant to hit
04:44Delete to delete a record.
04:46I'm going to click Yes.
04:47And it returns me back to just four Album IDs now.
04:51So editing, deleting and of course entering records, all very important.
04:56Data entry is vital to any database because as you know, without the data
05:01there is no database.
Collapse this transcript
Working with data
00:00We're going to look now at formatting data in a Microsoft Access database.
00:05Formatting data is a little bit more involved than just say formatting text in a
00:09Microsoft Word document.
00:10Yes, we can go into our table and we can format the appearance of our data,
00:15changing the font, the size, bold, italics, etc..
00:19All of the stuff we can do in Microsoft Word, but in a database we can go a step further.
00:24We can format fields so that only certain kinds of data can go into them.
00:28For example maybe in this rating field here we only want numbers and as soon
00:32as somebody tries to type anything but a number, they get a dialog box that says they can't.
00:37So that kind of data formatting is what we're going to look at in this lesson,
00:41plus we're going to look at a shortcut that's going to save you some time when
00:44it comes to your data entry.
00:45In fact we're going to start with that.
00:47And before we do, we're going to open up another database that has a table with
00:51a lot more information in it than what we've got here so far.
00:55So let's go up to the Office button and we'll click on Open.
01:00Let's navigate to the Lesson2 folder of your Exercise Files.
01:04There's where you'll find Music Library 2.
01:07You can double-click that or one click and then Open will bring it up on your screen.
01:11Now you may see this security warning saying that certain content in the
01:14database has been disabled.
01:16Now this is a database that we are creating on-the-fly so I'm not too worried
01:21about security, but we'll click the Options to see that there's a VBA Macro in there.
01:25Now some people use VBA, that's Visual Basic, to create viruses and that kind
01:30of stuff, so we really want to be sure that when we enable this content we're
01:34sure that it's ours, and we are so you can go ahead and enable the content and click OK.
01:40So here's our Album table.
01:42We can double-click it to open it up and you can see it's the exact same
01:45table that we've been working with, but we've just got more data in here now to work with.
01:50So that shortcut I was telling you about comes to data entry and if you look at
01:54the number 11 right here, which is the Thriller album by Michael Jackson.
01:57I have it here on tape, and I've also got it on CD, but it's not listed here yet.
02:02So what I'm going to do is I'm going to select the entire record, copy and paste
02:05it, and then just make a couple of minor adjustments to save me some time.
02:09To select an entire record, you come over to the very far left, when we see the
02:13arrow pointing right we just give it a click to select one record.
02:17Now if I want to select more than one I can click and drag and you can see as
02:20I click and drag up or down, I'm highlighting more than one record, but for
02:24this exercise we're going to click on just a single record here, we want it highlighted.
02:28Now to copy it, we go up to the Office button.
02:31We can use the keyboard by pressing Control and the letter C as in Copy, or
02:36what I like to do, if I've already got my hand on the mouse is just right-click and choose Copy.
02:42So it's been copied.
02:43Now I just need to paste it where the new record goes.
02:46That means clicking over here on the left-hand side to highlight that entire
02:49row, and then anywhere in the shaded area just right-click and choose Paste.
02:54So you can see it's automatically numbered 14.
02:57It's not number 11.
02:59It's still called Thriller by Michael Jackson.
03:01It's still got the same rating.
03:03The Condition, Rack, and Media are going to change though.
03:07The condition for my CD is actually Excellent;
03:10they don't wear out.
03:12It's on Rack 1 and tabbing over to the next field to type in CD.
03:16When I hit Tab I'm on to a new record again.
03:19So that should save you some time.
03:21If you got duplication in there, where you've got the same album, but maybe
03:24it's on different media or at different locations for example, then you can use
03:28that copy and paste.
03:30Now how about formatting our data?
03:32Let's talk about simple text formatting like we're used to in Microsoft Word
03:37or Excel for example.
03:39If I click anywhere here in my table and I just don't like this font that's
03:43showing up by default and the font size.
03:45I can come in here and change the font by clicking the drop-down.
03:48I'm going to choose Arial.
03:50I like to do all of my work in Arial.
03:52There it is and you see that the entire table just changed to Arial.
03:57The size, I'm going to drop it down to 10, and although I haven't selected the
04:01entire table, all of the data in the table is changed to Arial 10.
04:06Obviously, if I went in here and clicked on italics everything turns italics.
04:10Same thing for bold, underline, etc.
04:13So that's just simple formatting like we're used to, and it all appears here in
04:18the Format section on the Ribbon here for our Datasheet.
04:20Now what if we want to just format what goes into a field?
04:24Now we know that the Album ID is counted for us;
04:27it's an automatic generator of numbers.
04:30But the Rating over here, maybe we want to make sure that a number goes in here,
04:34it should be an numeric field or a number field, and we want to make sure that
04:38the numbers are maybe center aligned.
04:41So what we can do is actually change our views.
04:43Right now we're in the Datasheet view.
04:44If we go over here to the left-hand side and click the View drop-down, you'll
04:49see Design View is another option, and if I click on that, I can see each of my fields.
04:54I can see their Data Types over here, if I want to put in a description I could,
05:00and you can see that this one up here Album ID has a little key next to it
05:03indicating it is the primary key.
05:06It's the one record that will always have a unique identifier.
05:10Down below, we've also got the Field Properties.
05:12So let's go to our Rating right here, which is a number.
05:16I'm going to click anywhere in Rating, and you can see down below the
05:19Field Properties change.
05:20The Field Size is set to Long Integer.
05:23If I click in here, I know I'm only going to need 1 to 5.
05:26I don't need a long integer.
05:28So I could go down to Single for example.
05:31Next, I have a Format field here.
05:33If I click in the Format and click the drop-down, I can see some different choices.
05:38Well I'm definitely not going to be putting money in there, whether it's dollars or euros.
05:43Fixed is an option, so is Standard.
05:45You can see Percent and Scientific are also options in there.
05:48So I'm going to go to Fixed and give that a click.
05:52Now you can see that Decimal Places is next with a fixed format using a number.
05:57I can choose a number of decimal places.
05:59I click in here, and if I don't want any decimal places, it's just going to be 1
06:04through 5, I'm going to choose 0.
06:07So all of this is formatting our data.
06:10We can do a lot more than just formatting the appearance of our data, but you
06:13can see we're formatting the way that data can be entered.
06:17There are other ways to do this that we'll look at a little bit later, a little
06:20more advanced, using input masks and using validation rules and so on, but for
06:25now that's a good head start in formatting our data.
06:28Let's move back up to the Views and change over to Datasheet now.
06:32You must first save the table.
06:33Do you want to save the table now?
06:35So you'll notice when we were entering records earlier, the tables
06:38automatically saved, but here we've made an actual design change to the table
06:42so we should save it.
06:44Luckily for us this little dialog box appears if we ever try to leave the Design
06:49View without saving our changes.
06:51So yes we do want to save our table now, but keep in mind you've got your Save
06:54button up here on the Quick Access toolbar.
06:57At any time you can save your changes.
06:59So now we've just made it, the proper data is going to go into the proper fields.
07:04We've just gotten that much closer to what we call data integrity, and that's
07:08some simple formatting of data in a Microsoft Access database.
Collapse this transcript
Checking spelling
00:00By now you're probably realizing that things work a little bit differently in
00:04Microsoft Access and they do from the other applications in the Microsoft Office
00:08Suite, and that goes for checking spelling and grammar as well.
00:11If you think about Microsoft Word or Outlook for example, spelling and grammar
00:15can be checked on the fly.
00:17That's why we see those red and green squiggly lines under some of our text.
00:20Well in Microsoft Access, there is no grammar checker for one, and you can't
00:25check spelling on the fly, so you'll never see those red squiggly lines.
00:29There is a spell checker though that we can access whenever we want.
00:32Of course, when we enter data into a table in Microsoft Access, we want to make
00:36sure it's accurate, so using the spell checker now and then is a good idea, and
00:40here's how you do it.
00:42I still have the Music Library 2 open here on my Desktop and if you don't,
00:47you can go to the Exercise Files into the Lesson2 folder and find Music
00:51Library 2, open that up, and what we're going to do is actually type in
00:55something incorrectly here.
00:57Record number 13 here, Grease, which is Various artists, I'm going to take out
01:01the u, just so I have a spelling error in there, and you can see as I Tab along,
01:05nothing happens to the "Various."
01:07I don't see a red squiggly line showing up underneath.
01:10But as I'm entering my data, periodically I may want to use the spell checker.
01:14Now you'll want to make sure the Home tab is selected, because that's where
01:17you'll see under the Records section Spelling, and we'll give that a click.
01:21So right away it kicks into gear, it gets to the word "Various" which is missing
01:27our u, doesn't recognize it in the dictionary, and Various with the u is
01:32highlighted down below, so we can choose to ignore that, change it, add it to
01:38the dictionary, ignore all and change all are other options, and then we've also
01:42got AutoCorrect here.
01:44So some of the things you may be used to from the other applications in the Office Suite.
01:47This is one that we do want to change, so we'll click Change and you can see
01:51that the spell check is complete, so I can click OK.
01:55It's all fixed up for me and my table and you can see my cursor is sitting there
01:59inside that actual field in that record.
02:02Now let's go back to Spelling for a second, because you may have noticed that
02:06AutoCorrect is an option and AutoCorrect can be turned on so that as we're
02:11typing, things do get fixed for us on the fly.
02:14We won't see spelling errors on the fly, but we may want see them getting fixed.
02:18So I'm going to go up here to the Office button, and down to Access Options, and
02:24over here on the left I'm going to click on Proofing, and you can see under
02:28AutoCorrect options we do have a button, as well as some things are happening
02:32automatically for us like ignoring words in uppercase;
02:35they won't be considered spelling mistakes.
02:37Words containing numbers will not be considered spelling errors as well, unless
02:41we want to turn that off by clicking the checkbox.
02:44I'm going to leave it on.
02:45Because we're working with data, different rules apply.
02:48We do ignore Internet and file addresses like www.addresses or FTP addresses and so on.
02:55We do want to flag repeated words, and you can see we have a couple other options;
02:59enforce accented uppercase and French, if you are using any of the French
03:02characters, that can be turned on or off;
03:04and suggest from the main dictionary only is another option.
03:07Remember we can have many dictionaries, custom dictionaries, installed as well.
03:12But I want to go up to the AutoCorrect Options here, and show you some of things
03:15that are automatically corrected, and this applies to the entire Suite;
03:19it's not just Access.
03:20So what you see here is being used by Word, Excel, and Outlook as well.
03:24Correct two initial capitals is selected.
03:27So if you accidentally hold down the Shift key for a little too long and you get
03:31the word initial showing up like that it does get fixed.
03:34Capitalizing the first letter of sentences is something I turned off cause quite
03:39often you don't want a capital letter showing up after a period.
03:43So in this case Access would recognize a period as the end of a sentence and
03:47then the next word would be capitalized, but I use short forms with periods, so
03:51I turn that one off.
03:52Capitalize names of days is turned on.
03:54If you accidentally forget your caps lock key is turned on, after typing a few
03:58characters it'll get fixed for you, and then replace text as you type is turned
04:02on, which means all of these items down below come into play.
04:06So you can see here for example at the top, if I type in a round bracket, small
04:10c, and another round bracket, I get the copyright symbol, and then there's a
04:13whole bunch of frequently made mistakes down below.
04:16You can see the word abbout with two b's and as I scroll down there's a huge
04:21long alphabetical listing.
04:22One that happens a lot is that i before e except after c rule.
04:26So if we go down to receive, for example, I wonder if that one is in there. Getting closer.
04:34Look at that recieve, spelled "ieve" would be replaced automatically with the
04:40correct spelling of receive.
04:42Now keep in mind, you can add anything you like in here.
04:45You can choose what needs to be replaced with what and in some cases that
04:49could be a short form.
04:50For example, r1 I want replaced with Rack 1.
04:57By clicking the Add button now, every time I type in r1, the words Rack 1 will
05:03show up in my table, in my database.
05:06I'm going to click OK.
05:08And I'm going to click OK again to close that up.
05:11So you can add or remove any of the entries in the AutoCorrect Options and
05:15keep in mind too, that you should frequently check the spelling of the content of your database.
05:21In our case, working through a table, entering a lot of data, checking the
05:24spelling now and then, at least at the very end before you close out of the
05:28table, is always a good idea.
Collapse this transcript
3. Working with Fields and Records
Modifying table design
00:00All right let's talk about a common scenario.
00:02You're busy entering data into your table in Microsoft Access, and then it hits
00:07you, you're missing some information, you need to add something else, but
00:11there's no field for you to do it in.
00:13So we're going to talk now about modifying the table design.
00:17Still working with tables in Access, we're going to look at modifying the design
00:21from two different views:
00:22from our Datasheet view here, as well as from the Design view, and we'll look at
00:26the advantages of each.
00:28So let's go back to that scenario where we want to add some additional
00:31information, and in our scenario it's going to be an album cover.
00:34So each of these albums has a cover obviously.
00:37It would be nice if we could attach it to each of the records so that later
00:41on, when we get into forms and start viewing each record, in different ways
00:45using some tricks and forms, we'll be able to actually see the cover of the CD
00:49or the record or the tape.
00:52Another thing that's been bothering me for quite some time as we've worked
00:55through this sample table, is that some of the information is getting cut off.
00:58Look at Album Title here.
01:00Some of it's getting cut off and that's just simply because the column isn't wide enough.
01:04So we're going to modify some columns widths as well.
01:07Now we can do these design changes from two different views.
01:10We can do it right here in our Datasheet view.
01:12We can also switch over to Design view, and there's advantages to each, so
01:16let's look at both.
01:16We'll start with this annoying thing that's happening where information
01:20is getting cut off.
01:21I have a database open called Music Library 3, and I got it from my Lesson3
01:27folder of the Exercise Files, so if you want to open that up and follow along,
01:31you'll be right where I'm right now.
01:33So the Album ID you can see is just an automatic numbering system, and right now
01:37it's just way too wide.
01:39I need it to be wide enough to see the title Album ID, but it doesn't need to be
01:43this wide, so I can go in between the two columns, when I see the double arrow,
01:47I'll just click and drag to the left.
01:49So that works I can still see my title.
01:51Even better is to go in between two columns and double-click.
01:55This is a trick you can do in Excel as well.
01:58So double-clicking, you can see, will either increase or decrease the width of
02:02the column to accommodate the largest item.
02:04So I'm going to go through the rest of them, here in my Datasheet view, doing this.
02:10So it's easier for me as I'm entering data to actually see everything, see more
02:14columns as well as I shrink down some of these column widths, and now I need to
02:20add that new field that's going to contain the album cover.
02:23Now you can see I could do it right from here:
02:24Add New Field shows up.
02:26I could do some of the tricks like right -clicking to rename and so on, or I can
02:30simply switch to Design view, and I'm going to do that.
02:33I'm going to go up to my View drop-down and choose Design View.
02:37Now this is a little bit easier work with, especially when we need to define
02:41the Datatype and so on.
02:42So I'm going to come down here below Media, and I'm going to type in the name of
02:46this new field, which is going to be Album Cover, and when I click over here in
02:52the DataType column, you can see by default a text datatype shows up, and then
02:58you can see the field properties down below.
03:00But it's really not text going in there at all.
03:02It's going to be an image.
03:03So I'm going to click this drop-down and I'm going to choose from this long
03:07list, not Memo, Attachment right down here.
03:11And I'll be attaching a graphic image.
03:13Now with Attachment selected, look at the Field properties;
03:16there's only a couple to think about.
03:18One is a caption, and if I wanted to have a caption showing up on various forms
03:23for example later on, that aren't the actual label, Album Cover, then I can do
03:28that, but I'm going to leave it blank.
03:30Album Cover kind of speaks for itself and it will become the label when I start
03:34using forms later on.
03:36Is it going to be required?
03:38In other words does something have to be in there?
03:40No, I'm going to leave it at No.
03:41I may not have album covers for every single entry so I want to make this optional.
03:46So everything looks good, all I need to do is save my changes.
03:50If I don't, if I try to go back to my Datasheet view, I'll be prompted to make a
03:54save and I'm going to click the Save button to avoid that.
03:57So now when I change my view back to Datasheet, look at that, I've got a new
04:02column over here, which is Attachments and you can see the little paperclip icon
04:08represents the fact that it's an attachment type field.
04:12Now you'll notice that there are zeros showing up in brackets next to each one
04:15of these, cause currently there's nothing in those fields.
04:18So to add something, I can click on the field itself, and you can see I can't
04:23actually type in here, it's just a paperclip icon, but if I right-click, this is
04:28the fastest way, and choose Manage Attachments.
04:32There are no attachments.
04:33I can have more than one, but I really only need one album cover.
04:36If I wanted the back I could do that as well.
04:38But I'm going to click Add, and the next thing I'm going to do is browse over
04:43to my Exercise Files, and in the Lesson3 folder of the Exercise Files you'll
04:53find the Boston CD. (ph)
04:55Click on that, click OK.
04:58It shows up here now.
05:00It's a jpeg and when I click OK, look what happens up here.
05:03I've got a1 in there.
05:04Now in this Datasheet view, it's probably not the best view for looking at the album covers.
05:10Later on when we explore forms, you'll see how handy this becomes.
05:14Forms are a great way to either enter your data but also view your data, much
05:19better than the Datasheet view that we're looking at here.
05:22So we'll save that for later.
05:24We'll put in some album covers and later on when we work with forms, you'll
05:27see how nice we can actually place those somewhere on the form, where they can
05:31be viewed properly.
05:32So there's a couple of design changes.
05:34We made changes to the actual table widths, column widths in the table that
05:38is, and we made some changes by adding a field and choosing the type of field
05:43that we wanted in there.
05:45The Datatype in this case was an attachment, meaning we can attach actual files,
05:49in this case jpegs representing the album covers.
05:52Changing the design of your tables in Access is easy and it's inevitable that
05:57you'll probably at some point or another want to do it, so keep in mind that
06:01changing your database tables is something that's very common and very easy
06:05to do.
Collapse this transcript
Finding and editing records
00:00We're going to talk about another scenario here while we're working with data
00:03in tables in Microsoft Access that will pop up from time to time, and that's
00:08Find and Find & Replace.
00:10Much like using Microsoft Word or Excel using Find & Replace in those
00:14applications is much the same here in Access, except that all of our data that
00:18we're searching through exists in a table here.
00:21So we can find specific data when we're looking for it, and we can also replace
00:25that data with something else, if we use Find & Replace.
00:28That's what we're going to look at next.
00:30So I want you to imagine for a second that we've actually got thousands of
00:33records as opposed to just 17.
00:36You need to click on your Home tab and you'll notice up here, I'm using Music
00:40Library 4, that's from the Lesson3 folder of my Exercise Files.
00:44If you want to follow along go ahead and open that one up.
00:46It's just slightly different from previous versions.
00:49So let's say I want to locate albums by the Monkees.
00:52Well right now I want you to notice first of all, that my cursor's flashing in
00:56the Album ID column.
00:57That's important because when we come up here to click Find in the Find section,
01:01you'll notice that, by default I've got a 1 showing up in here because I was in
01:05Album ID record number 1, and what do I want to look in?
01:09It's important that we're not just looking for Album IDs, but in the entire
01:13Album table, so you want that selected.
01:15What we're looking for is Monkees, but we can just type in Monk and decide that
01:21we want to match any part of the field;
01:23it doesn't have to match the entire field or the whole field, or even the
01:26start of the field.
01:28Any part of the field can have Monk in it.
01:29We're going to search through all the records.
01:32We don't need to match case.
01:33When we hit Find Next, you can see we're brought to, there's Monk in the Monkees
01:37and that's Album ID number 8.
01:40When I hit Find Next, I go to the next one.
01:42I wonder if there's any more.
01:44When I hit Find Next, I get a message saying, no there isn't any more, and this
01:49search item was not found, so I click OK.
01:51So you can see, if you can imagine thousands of records, how quickly we can find
01:56a specific piece of data in that table using the Find feature.
01:59Now there's a Replace tab right here.
02:01I could switch right over to Find & Replace by clicking this tab, but if I want
02:06to start that from the beginning, I can go up here.
02:09Instead of clicking Find, click Replace.
02:11It's the exact same dialog box that shows up.
02:13You can see the Replace tab is selected this time.
02:16Even what I looked for last time in the Find What field, Monk is there, and some
02:20of the other options I selected are also previously selected.
02:24So they're set there for me by default.
02:26What I want to look for this time is the word Cassette, and I want to replace
02:34that with the word Tape;
02:36it really should be Tape, not Cassette.
02:38I'm going to look in the entire table again.
02:41This time I want it to match the whole field, and I do want to search
02:45through all the records.
02:46Now if I hit Find Next, it's going to take me to the first occurrence of
02:49Cassette from where my cursor was flashing.
02:52Keep in mind it was up here in Album ID number 9 here by the Monkees.
02:57So there it is I can hit Replace.
02:58It gets replaced and moves on automatically to the next one.
03:02If I just want to do them all quickly, I can click Replace All. They're all done.
03:07I won't be able to undo this Replace operation.
03:09Do I want to continue? The answer is Yes.
03:12And let's think about that for a second, that warning.
03:14Is it true that I won't be able to undo that?
03:17Well it's true that I won't be able to use the Undo function to go back to the way it was.
03:22But I can do another Find & Replace and just reverse these items, search for the
03:26word Tape and replace it with Cassette, but I'm happy.
03:29I'm going to click Cancel.
03:30Now it's says Tape everywhere where it did say Cassette, and I was able to
03:34quickly and easily locate specific data using the Find feature.
Collapse this transcript
Organizing and sorting records
00:00So we've been working with tables in Microsoft Access, and we've been inputting
00:04records into a table here.
00:06The records that you see listed are listed in the order that they were entered,
00:10and if we look down the left-hand column over here under Album ID, the numbers
00:14that appear here were automatically generated for us and you can see that
00:18basically each of these records is sorted by the Album ID at this point.
00:22But what if we wanted to see a list of all of our albums by artist,
00:26alphabetically listed, or maybe we want to list all of our albums by Rating,
00:30with the highest rated albums at the top and the lowest at the bottom.
00:34We can do that and we can even filter out records that we don't want to look
00:38at for the time being.
00:39So we're going to talk bout sorting and filtering to stay organized, and there's
00:43a couple different ways to do it.
00:44First of all you'll notice up here on the ribbon, if your Home tab is selected,
00:48you've got a Sort & Filter option here.
00:50So we've got sorting buttons to sort in ascending or descending order, and we've
00:55also got some filtering options here.
00:57Same thing under Selection and there's even an Advanced filter if we wanted to do that.
01:02Now keep in mind when we're filtering we're not running a query, we're just
01:05viewing the data differently.
01:06It's still all there but we're just viewing certain portions.
01:10Let's start with Sorting.
01:11Let's say I want to sort all of these by artist.
01:13Well, one way to do it is just to go to the column heading here on the
01:17right-hand side and click on the drop-down.
01:19Now when I do that I'm going to see those Sort buttons, Sort A to Z, that's my
01:23ascending order and my descending order is right below it, and notice also down
01:28below we've got a Text Filters option and then we've got check boxes for each of our artists.
01:33So I'm going to start with sorting A to Z. When I give that a click you'll
01:37notice that all of my albums are sorted by artist with Aerosmith at the top and
01:41ZZ Top at the bottom, but what's really important here is that we haven't just
01:44sorted the data in this one column.
01:47Each of the records has been sorted.
01:49Look at the Album IDs are all jumbled over here.
01:52We wouldn't want to just sort this column and then and then leave all of the
01:55other columns the same.
01:56Then we'd be messing up which Artist belongs to which Album Title and which Rating, etc.
02:01So the records are staying together as we sort on a specific field.
02:06Now you'll also notice that next to the drop-down arrow there's now that
02:09little arrow pointing upwards indicating that there's a sort on here or that
02:13there has been a sort.
02:14Let me show you what I mean.
02:15Let's do it by rating now, so we have the highest rated albums at the top.
02:19We'll click the drop-down and we'll do Largest to Smallest this time.
02:24So everything gets resorted now.
02:25You can see the fives at the top and then the fours, the threes, and the twos at the bottom.
02:32But the other thing that's happening here, because we did a sort on Artist, is
02:36that all of the fives are also being sorted alphabetically by Artist.
02:41So in effect what we're doing is a multilevel sort.
02:45Now let's take it a step further and do a little bit of filtering now.
02:48Back to the Ratings.
02:49I want to see all of my albums sorted by Rating and then alphabetically by
02:53Artist, but I only want to see the fives and the fours.
02:56I'm not interested in anything below a four.
02:59So I may want to go up to a filtering option here.
03:01Now I can do it by clicking the Filter button up here.
03:04When I do that, you can see what happens.
03:05This little drop-down opens up.
03:07I'm going to hit Cancel because the exact same thing happens when I click the
03:11drop-down under Rating.
03:12So there's my Sort and now down below, you can see I've got check boxes.
03:16One way to filter out the twos and the threes is to deselect them from here.
03:21I don't need blanks in there, not that there would be any.
03:23So I click OK, and you can see all I'm viewing now are the albums that have a
03:30Rating of four or five.
03:32The threes and the twos and anything below that do not show up.
03:36If I go up to my Filter button now, you can see that I get the same drop-down.
03:40If I want them all back I can click Select All and click OK.
03:45Similar to that is using the Selection Wizard here.
03:48If I click this drop-down, I can say give me all of the records that are greater
03:52than, or equal to, or between something.
03:55Now because I've selected five, and I'm currently on a record that has a Rating
04:00of five, my selections are showing up with fives.
04:03How about all the ones that don't equal five?
04:05When I click that, I'll see the fours, the threes, and the twos, but no fives.
04:09Then I've got this Toggle Filter button now that's shown up, so I can remove the
04:13filter and get them all back.
04:15So lots of different ways using sorting and filtering.
04:19Keep in mind when you want to remove all of the sorts that are going on
04:22here, we've only got two:
04:23Rating and then Artist, but we can remove all of those sorts by clicking the Clear button.
04:28You'll know that all of the sorts now have been cleared.
04:31First of all, the Album IDs are now back in order over here and you'll notice
04:35that those little arrows have disappeared next to the drop-down arrows on the
04:39columns that we were sorting.
04:41So if you want to stay organized while you're entering data into a table, you
04:44only want to see specific information, even though it's still all there you can filter it out.
04:49You can get it organized by using the drop-downs or by using the Sort & Filter
04:53options found up here on the ribbon.
Collapse this transcript
4. Creating Data Entry Rules
Setting field properties
00:00You know it really doesn't matter what kind of a database you're building
00:03in Microsoft Access.
00:04The data itself is the foundation, so it's extremely important that that data be
00:09accurate and consistent.
00:11Take for example, multiple people entering data into a table in Microsoft
00:15Access and one person likes to enter dates one way and someone enters dates another way.
00:21We want to make it so that everybody inputs a date the exact same way to enforce
00:26the integrity of our data.
00:28We don't want a lose that.
00:29Well there's a number of different ways for us to enforce data integrity in
00:32Microsoft Access and we're going to look at them in this chapter.
00:36We're going to start with the field properties for one and see how we can force
00:39people to enter data a certain way.
00:41We're going to look at input masks as well to narrow that down even further, and
00:46validation rules a little bit later as well.
00:49So let's start with the field properties, and you can see I'm using
00:52Music Library 4a here.
00:54I got it from the Lesson4 folder of the Exercise Files.
00:58It should look familiar to you if you've been following along.
01:01Here's a table that has Album ID, Title, Artist, there's a rating in here,
01:05which is a numeric field.
01:07You've got Condition, Location, and Media.
01:10So we're going to focus in on this Rating field here.
01:13We want to make sure that people are inputting the right numbers, the right way.
01:17So let's start with the Field properties.
01:18The easiest way to get to the Design view is to come up here from the Home tab
01:23on the ribbon and click the Design view button right here.
01:26We don't need to click the drop-down below which includes Design View, but
01:30Design view shows up right up here at the top, and clicking that will switch us
01:34to the Design view quickly.
01:35You'll notice that it's now the Datasheet icon that shows up over the View
01:39button, and I can switch back to Datasheet view quickly, going
01:43back-and-forth using this button.
01:45Now on the bottom right-hand corner on the status bar, you'll also find the
01:48Design view button and the Datasheet view buttons, along with the other two, and
01:53the one that's currently selected is highlighted, which is our Datasheet view.
01:57So let's switch back to Design view.
01:59That's where we want to work on the field properties.
02:02And like I said, we're going to focus in on this Rating field, which is a number data type.
02:07So I'm going to click anywhere in here in the Rating field and down below I'll
02:10see the Field Properties for that field.
02:13Now the first thing that jumps out at me is the very first thing here,
02:16Field Size set to Long Integer, and that means I can put in numbers up to
02:2164 characters long.
02:23Well my rating system's from 1 to 5, so I'm using up a lot of space here in my
02:27table that won't be used.
02:29I'm going to click in here where it says Long Integer, I'm going to slide over
02:33to the right, click the drop-down, and I'm going to go to Single, there we go.
02:40With Single now I know I'm going to save some space, and I'm only going to be
03:00putting in single digits, so this one works perfectly. (ph)
03:01The Format down below now is empty and if I click down here and click the Format
03:07drop-down I can choose from a number of predefined formats.
03:09Well it's definitely not a dollar amount that's going in there.
03:16It's not a percent.
03:18It's not a scientific number that's going in there.
03:19It's really just a fixed number, so I can use this one here, right in
03:34the middle: Fixed. (ph) XXXXX
03:35So I'll give that a click and it shows up now in the Format field.
03:42
03:52Decimal Places, we know we're not going to need any. (ph)
03:54It's set to Auto by default.
03:55So I'm going to click the drop- down here and change that to 0.
03:58You can see I can go quite high with my decimal places.
03:59All right we're going to skip over Input Mask, Caption, and go right to Default Value.
04:09We'll talk about Input Masks in the next lesson.
04:10The Default Value, well think about that for a second.
04:11If the majority of our albums are rated at, let's say 4, 4 out of 5, then we
04:15could make that the Default Value and never have to enter it.
04:24We'll only enter numbers that are not 4 when we need to. (ph)
04:25So I'm going to set that up as 4.
04:26Now there is an Expression Builder button over here that we'll look at when we
04:29get to validation rules.
04:30This can help you build equations, and so on.
04:31Really it's simple.
04:32The Default Value is going to be 4.
04:38We'll skip over the Validation Rule and Text and save that for later, and come
04:48down to the Required field. (ph)
04:52So do we have to have a Rating?
04:52Well, it's set to No by default, which means we could leave this blank, but I'd
04:55like to change that, so I'm going to click down here in Required and change that
04:57to Yes, so that every album has to have a Rating.
04:58So that way whoever is inputting the data cannot skip over that field.
04:59They'll have to enter something here.
05:00Index we'll leave at no;
05:01it's not a primary key, so we're not going to have unique values going in here.
05:05We're going to see 4s and 3s and 5s repeated throughout this table.
05:08Down at the bottom we can also choose how that is going to be aligned in the column.
05:15Right now General is the setting but I'm going to click the drop-down.
05:30I'd like to see those right down the middle. (ph)
05:30So I'm going to choose Center. There we go.
05:39So we're making changes to the design of our table and our database here.
05:43We need to save those changes before we go and test this out.
05:48So data integrity rules have been changed.
05:55Keep in mind that when you've got a table that has existing data in it that the
06:13existing data may not be valid for the new rules.
06:15Now I'm pretty sure that it is, and I will continue regardless by clicking Yes.
06:25Okay, so let's switch to the Datasheet view and take a look at our table.
06:33Look at the Ratings;
06:34they're all down the middle now.
06:38They do conform to a single digit, and no decimal places, so we're okay there.
06:50We didn't lose any data as a result of making those changes to the (ph) field properties.
06:51Now to enforce data integrity even further now, we can go to what's called an Input Mask.
06:55Input Masks force people to enter data a certain way.
06:56We're going to look at that next.
Collapse this transcript
Using input masks
00:00Another excellent way to preserve the integrity of your data as it gets entered
00:04into a table here in Microsoft Access is to use something called an Input Mask.
00:09An Input Mask is very helpful enforcing how data gets entered.
00:14Not exactly what data gets entered, but how it looks when it is entered.
00:18I like to use the example of dates.
00:20Everybody likes to enter dates a different way.
00:22You may like to enter them day, month, year using slashes, while I may prefer
00:27month, day, year using dashes.
00:29Well that wouldn't work in a table if we're both inputting data at the same time.
00:33So we want to enforce data integrity by keeping it consistent, making sure that
00:38anyone who enters data is entering it the exact same way, and this is what an
00:42Input Mask will do for us.
00:44In the previous lesson we looked at field properties for this Rating field here.
00:48We changed some of the properties to make sure there were no decimal places,
00:51that it was a number going in, and it's centered.
00:54You can see down here, the Default Value is set to 4 in our new record that's
00:58about to be created.
00:59The 4 is already there.
01:00So we're able to get closer to data integrity by setting up some of the field properties.
01:05Now we're going to go back to the Design View to set up an Input Mask.
01:09You'll notice up here in the Title bar I'm using Music Library 4b, and I got
01:14that from the Lesson4 folder of the Exercise Files.
01:16So if you're skipping to this lesson just go ahead and open that one up to get all caught up.
01:21The next thing I'm going to do is switch over to Design View.
01:23There's a couple different ways to do that.
01:25Look down here in the bottom right-hand corner on the status bar.
01:28There are View buttons down here including Design View.
01:31We've got our Pivot Chart, Pivot Table and Datasheet View.
01:35Datasheet View is currently selected.
01:36That's what we're looking at right now.
01:38An even faster way to switch between Design and Datasheet Views is to use
01:43this button up here.
01:44On the View drop-down we'll see those same four choices, but right above is
01:47the Design View icon.
01:49So if you click on that to switch to the Design View and it changes to
01:52the Datasheet View.
01:53So I can click it to switch back -and-forth, quickly and easily.
01:57So in the Design View, again we're going to focus in on this Rating field here.
02:02Down below in the Field Properties you can see what we set up in the previous lesson.
02:06But now we're going to go to the Input Mask right here.
02:09Now an Input Mask, when we're working with a number field like this requires us
02:13to enter it manually.
02:14There is a button to help automate things but that'll be working with a text
02:18field or a date field.
02:19Now an Input Mask is broken up into three sections and the three sections are
02:23separated by semicolons.
02:25The first section is going to contain characters, both literal characters and
02:29the mask characters.
02:31The literal characters are the ones that actually stay there, like brackets
02:35around an area code and dashes, and the mask characters are representative of
02:41what's going to go into this field.
02:43That's the first section.
02:44After the semicolon then is where we choose whether or not we're going to keep
02:47the mask characters with the data that gets entered and store that in the table,
02:52or do we just want the data.
02:54And then after the next semicolon, the third section is where we decide if we're
02:58going to use a placeholder or not.
03:00So if we were entering phone numbers, we might want to have the # representing
03:04the various numbers, just so people know how many characters they need to
03:07input, but it's optional.
03:08We don't have to have it either.
03:10So for our Input Mask, we want to make sure that it's one single character.
03:14Is that character optional or it is it required?
03:17Well we've already said it's required down below, so I'm going to put in a 9.
03:20A 0 is the other option if it's optional, but we're going to put in a 9.
03:24We're going to put in our semicolon now, and if we wanted to we can store the
03:29actual mask data with the data that gets entered, but there is no mask data
03:34here, there's no extra characters that go in there.
03:36So we don't have to put anything in here.
03:38If we wanted to we could put a 1 or a 0.
03:42So the one is going to represent us just storing the data.
03:46A 0 would mean we want the mask data and the actual data that gets entered in here.
03:52Next we'll put in a placeholder.
03:53Now if we wanted to we could put in an underscore for example, and that would
03:56show the spot where the actual characters get typed, but it's only going to be one character.
04:02We don't need it and we want to make sure that that default number of 4 that
04:05we've set up down here, the Default Value, shows.
04:08If we put a placeholder in here, it replaces the 4. So that's it.
04:11I'm going to hit Tab.
04:13It moves me to the next field and preserves my Input Mask.
04:17Now if I go to switch to Datasheet View, I'm going to be prompted to save my
04:20changes, so I might as well come up here and save them ahead of time.
04:23Now I'm going to go to my Datasheet View.
04:25This switches me over.
04:27You can see the 4 is still showing up here in the new record, and I'm just going
04:31to click over here by CD and hit my Tab key a couple of times.
04:34It gets me down to the new record.
04:36I'm going to hit Tab again, then I'm going to typed in Now! 2.
04:42Again that's Various artists.
04:44The Rating's 4, that's perfect. It's on CD.
04:48I'm going to put in Excellent here.
04:53This is actually on Rack 4. I just got it.
04:55It's on the new rack. It's a CD.
04:58Now if I go back here to my Rating, and I try to put in more than one digit.
05:03Let's say I want to put in 33.
05:04Type in the 3, and then as I hit 3 again, it's not letting me add any other characters.
05:11I'm only allowed the one.
05:13So 4 was the default. I can put in a 1.
05:15I could put in a 2, a 3, a 4, a 5.
05:21I can also put in a 6.
05:23So I can only put in one character.
05:25I'm going to leave it at 4, but I'm also allowed to put in numbers higher than 5.
05:29That takes us to the next lesson where we're going to talk about
05:33Validation Rules.
Collapse this transcript
Setting validation rules
00:00Okay here's where you get to feel a little bit like a programmer using Microsoft Access.
00:05What we're going to do now to take data integrity to the next level is create
00:09rules for what data can go into a field.
00:13So as data input people start entering information into the various fields, we
00:17want to force them to input only certain data.
00:20For example, in our Rating column here we have a rating system from 1 to 5.
00:24We don't want people putting zeros or sixes for example.
00:28That's not acceptable.
00:29So we can set up a rule that says it has to be 1, 2, 3, 4 or 5. Nothing else.
00:34Look at some of these other columns as well. The Condition.
00:37Well we've only got Poor, Good and Excellent.
00:39So we want those three choices, and we want people to enter it that way and
00:43spell it correctly too.
00:44Same thing goes for the Location and the Media.
00:47So we can set rules for each of these and we're going to have fun with
00:50another Input Mask as well.
00:52So we do all of this from the Design View like we did for our Input Mask and
00:55our Field Properties.
00:57Notice up here that I'm now using Music Library 4c.
00:59If you've been following along, no problem, but if you're jumping to this lesson
01:03this is the one you'll want to open up to be all caught up.
01:06Music Library 4c from the Lesson4 folder of your Exercise Files.
01:11Once you've got it open let's switch to Design View.
01:13We'll click the Design View button here and we'll go back to our Rating field.
01:17We'll start with that one here, so clicking in the Rating field, you can we've
01:20already set up some things including an Input Mask that says it's got to be one
01:24digit, but we haven't said yet what those digits can be.
01:28We want 1, 2, 3, 4, or 5. That's a rule.
01:31So we come down here to the Validation Rule part and notice that we've got a
01:35little button over here for building our Validation Rules.
01:38You can click that to open up the Expression Builder.
01:41Now we can use some of the built-in functions by double-clicking Functions,
01:45and clicking Built-In Functions and you can see we've got some prebuilt choices for us.
01:48Or we can just come in here and type in what the rule is.
01:52So in this case it has to be 1, Or, I'm going to click the Or button, 2, click
01:59Or again, 3, Or, 4, Or, 5.
02:04That's our rule right there.
02:05We just click OK, that gets entered into the Validation Rule field, and now,
02:10this is kind of neat, we can add some text that'll show up when people enter
02:14something other than 1 through 5, such as:
02:19You must enter a number from 1 to 5, just like that.
02:27So there's our Validation Rule.
02:29We've set it up, we've added some Validation Text as well, so if people don't
02:33enter the right data, we're at least giving them some information about what
02:36they should be entering.
02:37So we're going to save that change.
02:39We'll click the Save button.
02:41Data integrity rules have changed.
02:43We know that we just set them, and notice that it's just saying it might take a long time.
02:47If you've got hundreds and hundreds of records for example, and you've already
02:50got data in the Rating field it could take a while to check to make sure that
02:54data rules are being followed.
02:56So we're going to click Yes, and we're going to switch to our Datasheet View,
02:59and I'm going to click in here and just Tab over to a new record.
03:04Now I'm going to enter in an Album Title.
03:06I'm going to enter in Bad by Michael Jackson.
03:16The Rating I'm going to change to a 5.
03:19Now what if I try to put in a 6 here. Let's type in 6.
03:23As soon as I hit Tab to move to the next field, oh, there's that text.
03:26You must enter a number from 1 to 5. So click OK.
03:29I better put in 5, and now as I Tab through I can start entering the rest of the information.
03:35But we can create some Validation Rules for these other fields as well, so that
03:40people can only put in one of three choices:
03:42Poor, Good or Excellent for the Condition.
03:45They can choose from Rack 1 through 4 and then same thing for the Media type.
03:50So what we're going to do now is go back to Design View and we're going to work
03:54on those other ones.
03:55Let's start with the Condition.
03:58So the Condition can be one of three choices;
04:01that's a Validation Rule.
04:02When we work with text we put it in quotes.
04:05So for example, I'm going to put in a quote here, double quotes, and I'm
04:10going to put in Poor.
04:12Now I can type this or I can go to the Expression Builder and do it there if I wanted to.
04:16So Good in double quotes Or and in double quotes the last choice which is Excellent.
04:27Now if I wanted two for Validation Text, Must be Poor, Good, or Excellent.
04:33 There we go. (ph)
04:37Now when I hit Save, watch what happens here, same information pops up saying
04:41it could take a while. I say Yes.
04:43Existing data violates the new setting.
04:46That's because I've got some blanks in there don't I, but that's okay, I'm going
04:49to click Yes to continue, and I'm going to switch to my Datasheet View here, and
04:54we're going to continue with our new record here and I'm going to type in
04:57something like okay. Look at that.
05:01Must be Poor, Good, or Excellent.
05:03So I click OK and I'll take that out and I'm going to type in Good.
05:08Tab over and now I'm ready to move on to the Rack.
05:11Well, let's change that up as well.
05:13Let's make some rules for what can go into the Location field.
05:16We'll go to our Design button to switch to Design View.
05:21We'll click on the Location field and we're going to use an Input Mask here as
05:25well, because what we really want to do is have some text in there: Rack.
05:29So all you need to enter is the 1, the 2, the 3, or the 4.
05:33So it's going to look kind of like this:
05:35I'm going to put Rack and a space in quotes, and then we want a number after that.
05:40So we're going to put in a 0 to represent an optional number, and then we'll
05:44put in our semicolon.
05:46This is all covered in the previous lesson.
05:48We do want to save all of the Mask Data, like the word Rack, with the data, so
05:52we're going to put in a 0 here.
05:54The choices are 0 or 1, and then we're going to put in a semicolon, and if we
05:58want a placeholder, we can put it in here.
06:00I'm going to put in the underscore. There we go.
06:03Validation Rules now.
06:05Obviously this time we've got four choices, so what we want to do, I'm going to
06:09go into the Expression Builder here, and I'm going to type in, in quotes,
06:14double quotes, Rack 1, Or, and I'm going to copy this here, so I don't have to type it each time;
06:22Control+C on the keyboard.
06:24Control+C, Or, Control+V, there we go, and I'm just going to change the
06:32numbers now to 2, 3, and 4.
06:39When I click OK, that's entered for me.
06:42Now I'm going to hit my Save button.
06:43I'm going to see a familiar message.
06:45I'm going to say Yes.
06:47Existing data violates that. We know.
06:48We've got a blank in there, but that's okay.
06:50When we click Yes and switch to the Datasheet View, you can come in here. Look at it that.
06:55The word Rack is already there, so we would move from Good by hitting Tab.
06:59We just type in a number here.
07:01I'm going to type in 4, and you can see Rack 4 shows up for me.
07:05I hit Tab and we're on to the Media.
07:07So here's where we can set up yet another rule.
07:09So let's get some practice.
07:11We'll go to the Design View now, switch over to Media and creative a
07:16Validation Rule here.
07:17So this is text again.
07:18Let's just type it in here this time.
07:20So we'll use our double quotes.
07:21The Media can be CD, Or, it can be Tape, Or, and in double quotes we'll put in
07:30the other option, which is Vinyl. There we go.
07:34If we want, in the Validation Text, put a message in there.
07:38Must be CD, Tape or Vinyl. There we go.
07:44Let's save that up.
07:44We're going to see the same messages again.
07:48Obviously, we've got a blank in there, that's why we see this violation.
07:51It's okay, we'll click Yes, go back to the Datasheet, and from Rack 4 we'll hit
07:56Tab, and let's try and type something in like Cassette.
08:01When I hit Tab to move on, it says, Oh, must be Cd, Tape, or Vinyl. So I click OK.
08:06I'm going to double-click here and just type in Tape.
08:10When I hit Tab, that one's accepted, and I've saved my changes.
08:14So you can see how, now where we're preserving the integrity of our data by
08:18forcing people not only to put in the data that we want, but to make it look the
08:22way we want as well.
Collapse this transcript
5. Relational Database Techniques
Creating key fields
00:00To this point in this title, we've been working with a single table in Microsoft
00:06Access, and we've done a lot of stuff with this table called Album here, where
00:09we've added some fields, and we've worked on field properties and we've also
00:13adjusted some of the Validation Rules and the Input Masks, etc, but to be quite
00:18frank, we could have done everything we've done so far with this single table in
00:22Microsoft Excel in a spreadsheet, but we know from a previous lesson when we
00:26discussed design concepts that a flat file is very inefficient.
00:31What would happen over time is we would see a lot of redundancy, repetition,
00:36duplication of records.
00:37So by creating multiple tables and relating them to one another, we create a
00:42relational database that's far more efficient.
00:45We'll be able to quickly and easily find data, look it up, present it later on.
00:50So what we need to do in this section is talk about relationships between tables
00:55and to do that we first need to discuss keys.
00:58Now I'm using the Music Library 5a database from the Lesson 5 folder of
01:04your Exercise Files.
01:05So you'll need to open that one up, because you'll notice over here in the
01:07Navigation Pane, I've got more than just the Album table now.
01:11I've created a Performers table and a Songs table.
01:15Now, we said we were going to do that in a previous lesson when we were talking
01:19about design on paper. So here they are.
01:22You know how to create a table.
01:23I've just gone ahead and created these two tables and we'll take a look at them
01:27in a minute to see what fields exist in there.
01:30If we go to the Design View here for our Album table, we'll see the various
01:34fields, their DataTypes and properties.
01:36What's really important to remember though is that the Album ID is our unique identifier.
01:41We'll never have a Duplicate ID for any given album, and you'll notice that
01:45that's because we've got this little key icon next to Album ID representing that
01:50this is our primary key.
01:52All right, so if we go over to the Performers table now and double-click it to open it up.
01:58We're currently in the Datasheet View.
02:00You can see we got a Performer ID field.
02:02I'm just going to stretch that out a little bit.
02:04We've got First Name and Last Name fields. That's it.
02:07If we go to the Design View, we realize that we don't have a primary key here.
02:13So we could have two different performers, for example with the same Performer
02:18ID and we don't want that.
02:19So what we're going to do is set up the primary key for this field here: Performer ID.
02:24So I just need to be anywhere in the field.
02:26I'm going to go up to the Ribbon.
02:28My Design tab is selected here and click on the Primary Key button. It's that easy.
02:34So we've now set up the primary key for our Performers table.
02:38We need to save those changes for them to take effect.
02:41Now take a look at what I've done over here in the Songs table.
02:45I'm going to double-click it and switch to Design View.
02:48You can see here we've got the Song Title, the Genre, the year it was
02:53launched, the Decade, and then I've got two fields down here that I can find
02:57in the other two tables.
02:58There's the Performer ID, which is a primary key in the Performers table, and
03:03there's the Album ID, which is a primary key in the Album table.
03:07So I don't actually have a primary key or a unique identifier in this particular
03:12table, and that's okay in Access, you can do that, but just to be safe later on,
03:16it might be a good idea to have a Song ID, and we can have it automatically
03:21generated for us so we don't have to worry about it and although we don't need
03:24it right now, maybe down the line it will be important if we start to add
03:28additional tables and we want to be able to link them.
03:31So we don't want to have to go back and re-design our table.
03:34So what we're going to do now is actually insert a field, and I'm up here at Song Title.
03:39I'm going to go up to the Ribbon, under the Design tab here and click Insert Rows.
03:43So I've got a new row, which will represent my new field.
03:47I'm going to call it Song ID and over here in the Data Type, we want that to be
03:51an automatically generated number.
03:53They have AutoNumber here for us; that's perfect.
03:57That'll automatically generate a number;
03:58we won't have to input anything there and we'll know for sure that no
04:02number will be duplicated.
04:04So now all we have to do is make it the primary key by coming up here in the
04:07Ribbon and clicking Primary Key.
04:09As soon as we did that in the Field Properties down below, you may have noticed
04:13next to Indexed, it went from Yes and ( Allow Duplicates) to (No Duplicates), so
04:18its indexed and there cannot be a duplicate because it's a primary key.
04:23So we want to save that change as well.
04:26So now we've got our three tables.
04:28Notice the three tabs up here.
04:30Here's our Performers;
04:31the Performer ID shows up here as the primary key.
04:34In the Songs table it shows up down here, and then if we go over to the Album
04:39tab we've got an Album ID as the primary key.
04:42We'll go back to Songs and there's Album ID down there.
04:45So we're going to be able to relate each of these tables one to the other in a moment.
04:51That's what we're going to do next when we talk about table relationships.
Collapse this transcript
Creating table relationships
00:00All right it's time to have some fun now with relationships.
00:03We're going to put the relation back into relational databases now.
00:08In the previous lesson we saw that we had three tables in this database:
00:11the Album, Performers, and Songs tables.
00:14Each one of those is set up now with a primary key or a field that will
00:18contain a unique identifier, and then some of those fields appear in other
00:22tables as well, so that's how we can build the relationship, join the two
00:25tables by the common fields.
00:29So to create the relationships, the first thing that we need to do is close up all the tables.
00:34It's hard to create the relationships and save that relationship if the
00:37tables are in use, and right now you can see the Songs, Performers, and Album
00:41tables are all open here.
00:43So I'm going to right-click on the Songs tab.
00:45It doesn't really matter which tab you right- click on, and select Close All. There we go.
00:51Up at the top you'll notice that I'm using Music Library 5b.
00:56Now if you jumping to this lesson that's the name of the database you want to open.
01:00If you're continuing on from the previous lesson you'll still be using Music Library 5a;
01:05it's all the same stuff.
01:07Now we need to create the relationship between those three tables, so
01:10we're going to go over here to the Database Tools tab on the Ribbon and give it a click.
01:14Right below that you'll find the Relationships button. Perfect.
01:18When we click that, the Relationships tab opens up, but for the very first time
01:23only the Show Table dialog box will also show up.
01:27Now we can create relationships between tables, between queries, and both, but
01:32we haven't got to queries yet, so we'll save that for later and just concentrate
01:36on the tables for now.
01:37There's our three tables in this database, Album, Performers, and Songs, and all
01:41we need to do is get them from here to here.
01:45So with Album already highlighted or selected, I can click the Add button and
01:49you can see that table gets added.
01:50I'll click Performers and Add, and a shortcut, I'll just double-click Songs to
01:55add that one as well.
01:57So once I've got them all in there, I can close this dialog box, and I've got my three tables.
02:02Two of them have scrollbars indicating I'm not seeing all of the fields.
02:06So what I'm going to do is just click and drag until I see them all. Perfect.
02:10Just like that.
02:12The other thing that I need to do is just move these around a little bit.
02:15I'm going to move Performers over here, Songs in the middle, and that way it's
02:20going to look a little bit neater when we join these tables up.
02:23You'll see what I mean in a second.
02:25So how do we join them up?
02:26How we create the relationship?
02:28Well it's pretty easy actually.
02:29We know that Album ID is the primary key here, we see the key in the Album table.
02:34We also see that same field over here in the Songs table, and it's spelled
02:38exactly the same way.
02:40So all I need to do is click and drag from the key, right on top of the second
02:45Album ID field and release and the Edit Relationships dialog box will appear.
02:50So you can see a relationship is being created between the Album ID fields, one
02:56from the Album table, one from the Songs table.
03:00Down below, you can see by default, it knows to create a one-to-many
03:03relationship, because Album ID in the Songs table is not a primary key, and that
03:09means that one-to-many.
03:11I can have one ID in the Album table and see that Album ID many times in the Songs table.
03:17So that's perfect.
03:18All I need to do now is Enforce Referential Integrity.
03:22I'm going to click this check box.
03:23We're going to talk about this in detail in a couple lessons from now so we'll
03:27just leave that be, but it does need to be turned on, and it'll all make sense a
03:31little bit later on.
03:32Now we can also look at the Join Type.
03:34So what happens when we take tables that already have data in them and start
03:38joining them like this.
03:39Well I'm going to click the Join Type button and you'll see I've got three
03:43options for Join Properties:
03:45Only include rows where the joined fields from both tables are equal.
03:49Well I know that my Album table is full of data, but the Songs table doesn't
03:53have anything in it yet.
03:54So maybe option two will be better:
03:56Include all records from 'Album' and only those records from the Songs table
04:01where the joined fields are equal.
04:03That sounds like what I want.
04:05What's the third option?
04:06Includes all records from the Songs table, I don't have any, and only those
04:10records from the Album table where the joined fields are equal.
04:13That does not apply either.
04:14So with number two selected, I'm going to click OK.
04:16So right away I see that two fields are going to be joined together.
04:23Enforcing Referential Integrity;
04:25we'll talk about that later.
04:26One-to-many is the relationship.
04:28When I click Create, look what happens.
04:31I see the relationship from Album ID here, there's the one, to the infinity
04:38symbol representing many in the Songs table.
04:42So let's do the same now with the Performers.
04:44We'll drag the Performer ID over and into the Songs table right on top of
04:50Performer ID and release. So there we go.
04:54We've got the two fields, the two tables.
04:57We do want to enforce referential integrity.
04:59It will be one-to-many.
05:02The Join Type really doesn't matter, both of these tables are empty right now,
05:06so we can only include rows where the joined fields from both tables are equal;
05:09that'll work and click OK.
05:12When I click the Create button, there's my new relationship.
05:16Now as I move these tables around, they keep their relationship.
05:19They're always joined.
05:22If at any time I need to edit one of these relationships, I can go to the
05:27connector and double-click.
05:29It opens back up the Edit Relationships dialog box.
05:32I could go up here on the Ribbon and choose Edit Relationships as well. I'll click Cancel.
05:40All I need to do now is save those changes.
05:42When I click the Save button, all of my relationships will be stored, and
05:47I'm ready to move on.
05:49In the next lesson we're going to spend a little bit more time digging deeper
05:53into referential integrity and why it's so important.
Collapse this transcript
Enforcing referential integrity
00:00It's time now to discuss an extremely important topic when it comes to working
00:04with a relational database, and that's referential integrity.
00:08Now in the previous lesson we set up relationships between our tables in our database.
00:13We see those relationships now as one-to-many relationships.
00:17We see the primary keys in each of the tables, but let's talk about a
00:21scenario that could happen.
00:23Let's say we gave away an album and we no longer have that album in our library.
00:27So we delete the album from the Album table knowing that there are songs in the
00:32Songs table that reference an Album ID now that no longer exists.
00:37What happens to those records.
00:38Well without enforcing referential integrity, well we would have what's called orphans.
00:43We'd have a number of songs with an Album ID that can't be found in the Album table.
00:49Now by enforcing referential integrity, a little check box that we checked off
00:53in the previous lesson, we'll look at it again in a second, we're making sure
00:57that we can't let that happen.
00:58Orphans won't exist as long as we're enforcing referential integrity.
01:02So that's going to mean that we can't change the primary key for an Album ID and
01:06we can't even delete it, but let's say we gave away an album or we sold it for
01:11example, and it no longer exists in our library.
01:13We want to be able to delete it, and in those cases we want some kind of
01:17update to happen here in the Songs table, and that's what we're going to talk about now.
01:21So take a look at my title bar.
01:22I'm using the Music Library 5b database.
01:26So if you're jumping to this lesson, you can go into your Lesson5 folder in the
01:29Exercise Files and open it up.
01:31We created the relationship in the previous lesson by just simply clicking and
01:35dragging the primary key over on top of the foreign key in the related table,
01:39and now we're going to talk about enforcing that referential integrity.
01:43So that's going to mean editing our relationships.
01:46To do that we click on the connector between the two tables, you can see it's
01:49highlighted, and we can go up here and click Edit Relationships to bring up the
01:54Edit Relationships dialog box.
01:57So in the previous lesson we did check off Enforce Referential Integrity.
02:01So by doing that we knew we would not have unrelated records in the related
02:06table, but here the other two options I want to talk to you about.
02:09What if we change the primary key?
02:11I'm going to move this over.
02:12Let's say over here in the Album ID we want to change the actual ID for one of our albums.
02:18Well we would want those IDs in the related table, the Songs table here, to get
02:23updated for us automatically, so that they continue to match each other.
02:27Well, then we would check off this check box here that says Cascade
02:30Update Related Fields.
02:32Now what happens if we sold one of the Albums in our collection and it no longer
02:37exists, so we're deleting an Album ID.
02:39That means we might have a number of songs referencing an Album ID that no longer exists.
02:44We can't have that because we're enforcing referential integrity, but what we
02:48can do is have Access automatically delete all of the songs in our Songs
02:52table that reference that Album ID that's been removed, and that's this check box here:
02:57Cascade Delete Related Records.
03:00So with those two checked off, we can click OK and know that we'll always have valid data.
03:07Let's go over to this one now.
03:08I'm going to click on the relationship between Performers and Songs.
03:11Another way to edit relationships, a little shortcut, is just to
03:14double-click the connector.
03:16So double-clicking brings up the Edit Relationships dialog box for these two tables.
03:20You can see Performers and Songs.
03:23Now, we also enforced referential integrity in the previous lesson for these
03:27two tables, what do we want to happen if we remove a performer from the Performers list?
03:33Do we want those Performer IDs to be deleted as well, in the Songs table. Well, yes we do.
03:40So we're going to click this check box here.
03:42If we change a Performer's ID, we also want it updated in the related table, so
03:46we'll check off this box as well, and we'll click OK.
03:50All right we should save those changes, so clicking the Save button will update
03:55our tables, their relationships, and now we can feel confident knowing that if
04:00we change an ID in one table, it'll change in the related table.
04:04If we remove one from the primary table, they will all be removed from the
04:09secondary or the related table as well, all thanks to something called
04:13referential integrity.
Collapse this transcript
Using subdatasheets
00:00Now that you're feeling very comfortable with the term referential integrity and
00:04table relationships, it's time to talk about something that will help you when
00:08it comes to data input, and that's a sub datasheet.
00:11As soon as we create relationships between tables like we have here in our
00:14database, linking the Album ID in the Album table to the Album ID field in the
00:19Songs table, and also linking the Performers table by Performer ID to the
00:24Performer ID field in the Songs table, we now have a relationship.
00:28We've enforced referential integrity so that the way we set it up if we were to
00:32remove an Album, all of the songs with that related Album ID would be removed as well.
00:37If we were to change information in the Performer ID in the Performers table, we
00:42would see those changes in the related table under Songs here, all the Performer
00:46IDs would be updated.
00:47So with all of that in mind, now we're going to look at a little feature, the
00:51sub datasheet, which is going to help you when it comes to data input.
00:56Now before we continue you're going to need to open up the database called Music Library 5c.
01:01That's in your Lesson 5 folder of the Exercise Files, and once you've got that
01:06open I want you to go over to the Performers table and double-click it here in
01:10the Navigation Pane.
01:12You'll see, I've added some performers for you.
01:15Now what's new about this, something you haven't recognized maybe, is the little
01:19plus signs down the left- hand side, next to each record.
01:22This represents the sub datasheet which is a Datasheet view of the related table.
01:29So we know Performers is related to the Songs table through that Performer
01:33ID, so if I click the plus sign here next to Boston I'm going to see the sub datasheet.
01:39Now there are no songs in here yet, but I can use the sub datasheet to actually
01:43input new songs using this Performer ID.
01:47Notice that there's no Performer ID column.
01:50I don't need to put that in because it's related and it will automatically be
01:54updated with this Performer ID.
01:56I do need to put in the Album ID though and that I may not know off the top of my head.
02:02If I go over to the Album table and double-click it, you'll notice that all of
02:06the albums show up here with the Album ID's and here we go.
02:10We've got plus signs next to each one of these as well representing the related
02:14table, which again is the Songs table, so clicking the plus sign here next to
02:19Boston will display the Songs table in a sub datasheet.
02:23Again, I don't have any songs input yet, but I can start inputting them here.
02:27Notice also that the Album ID column now doesn't show up here, but there is a
02:31Performer ID column.
02:34So this is just one way to help us with our data input to see more than one
02:38table's worth of data at that time.
02:41We can input songs from the datasheet, we can input songs from the datasheet
02:45under the Performers table here, and of course if we go to the Songs table and
02:50double-click it, we can put in new songs here as well.
02:53So I'm just going to put one in here in the Songs table.
02:56Song ID is 1 by default.
02:58I'm going to tab over to Song Title.
03:00I'm going to type in More Than a Feeling. The Genre is Rock.
03:07The year that this came out was 1976, which would make it the 70s.
03:12The Performer ID, I know just from looking at the two tables is 1.
03:16The Album ID is 1 and when I hit Tab I'm on to a new record.
03:19Now I'm going to go back to the Album tab up here, and now I don't see that
03:24updated field yet, or that updated record in the Songs table until I refresh.
03:29When I click the Refresh button notice that that song now shows up in the sub datasheet.
03:35Same thing if I go up to Performers here and refresh, you can see I've got that
03:40Song ID in there as well.
03:42Of course Refresh All would just update all of the tables and their sub datasheets.
03:47So the sub datasheet is a great way to see more information than just what's the
03:51one table you're working in.
03:53You can always see related information in the related table, but you can also
03:57use a sub datasheet to input new data as well; keep that in mind.
04:02Now we're only going to see related information in a related table.
04:06What if we wanted to input data into all three tables at one time?
04:10In other words have access to all of the fields in all of the tables in our database.
04:15Well that's where a query might come in handy.
04:18In the next chapter, we're going to dive into the topic of queries in
04:22great detail.
Collapse this transcript
6. Working with Queries
Creating a query using the wizard
00:00Before we actually create our very first query with a little help from Microsoft
00:04Access using the Query Wizard, it's important that you understand what the term
00:08query means specifically in Microsoft Access.
00:12Now, like the name implies, it's kind of like asking a question.
00:15In this case though with a relational database, we'll be asking for information
00:20from any or all of the Tables in your database for example, or maybe we want to
00:24create a New Table out of information we pull from various other Tables.
00:29Another option might be to find any records that don't have matching records
00:33in a related table, or on the other hand, we may want to find Duplicates if they exist.
00:38These are four examples of queries that can be created using the Query Wizard
00:43in Microsoft Access.
00:44That's what we are going to do now.
00:46You will notice up here on the Title Bar I am using Music Library 6a.
00:49So you can open that up from the Lesson6 folder of your Exercise Files, and you
00:54will be all caught up with me.
00:56The next thing we need to do is click the Create tab on the ribbon and over here
01:00on the far right, you will notice in the other section, we have got Query Wizard
01:04and Query Design, two different ways to Create queries.
01:08We are going to focus-in, in this lesson on the Query Wizard.
01:11When I hover over it, you will see that I can create Simple queries, Cross-tab,
01:15Duplicates, and Unmatched queries.
01:18Those are the four examples I just talked about.
01:21So let's click the Query Wizard button.
01:23This is a New Query and you will see those four samples right here, Simple,
01:27Crosstab, Find Duplicates, Find Unmatched.
01:31Now, as I click on each one of these I get a little bit of information over here.
01:35The Simple Query Wizard is going to help me create a select query, and that's
01:40from the fields I pick from the various tables or table.
01:45Now, if I click on Crosstab Query, you can see that this Wizard creates a
01:48crosstab query that displays data in a compact spreadsheet-like format.
01:52So you create a new table out of your choices.
01:56Find Duplicates Query Wizard, creates a query that finds records with duplicate
02:01field values in a single table or query.
02:04So I can do queries on queries, and Find Unmatched Query, this wizard creates a
02:10query that finds records.
02:11In other words rows in a table that have no related records in another table.
02:17So they'd be kind of like orphans.
02:18Now, with Referential Integrity turned on, we are not likely to find
02:23any unmatched records.
02:25So I am going to go back up to Simple Query Wizard, and click OK.
02:28So right away, you can see I have got a drop-down in the Simple Query Wizard
02:34screen here, step one where I get to choose the table.
02:37So if I click on for example Performers, I will see the Fields in the Performers Table.
02:44If I click on Songs, I see all of those Fields.
02:48Now, I am going to choose the Fields that I want to use in my query.
02:54It's important to know here that I can pick Fields from this Table, and then go
02:58pick some more Fields from another Table.
03:01So what I am going to do from the Songs Table is choose Song Title.
03:05I am going to click the single arrow to move that over.
03:07The double-arrow allows me to move them all over if I wanted every single
03:11Field in this Table.
03:12But I just want Song Title right now, and I am going to use the Performer ID.
03:17Now, I am going to click the drop-down and I am going to go to the Performers Table.
03:24I would like to get the First Name and the Last Name of the Performer.
03:32When I click Next, I move onto the next screen, and I get to name my query.
03:37So I am going to leave the default in there which is Songs Query, but you can
03:41type whatever you like and then my options down below are to Open the query to
03:45view the information that's pulled out, or to Modify the query design.
03:50We are going to get into Query Design in the next lesson and then further
03:53modifications a little bit later on in this title. So I am done.
03:57I simply click Finish, and you can see what happens here, I get all of my songs. Here they all are.
04:03You can see the Performer ID that was the Field I selected.
04:07You can see the First Name and the Last Name of the performer.
04:11So if I come down here and I am just going to double-click in between the
04:14columns to adjust their widths to accommodate the largest entry in each.
04:22I come down here to Why Oh Why.
04:26I see that that's Celine Dion. Her ID is 3.
04:29Now, I may want to use this in something else.
04:31The neat thing is that I can update records using this query if I wanted to.
04:37When I hit Tab at the end, in the last Field here and hit Tab, you can see I can
04:41type-in New Song Titles, IDs, First Names and Last Names if I wanted to.
04:46So I am not going to do that.
04:47I am only going to use this query to look at the information but that's a good
04:51example of a simple query where we are extracting information from one or more
04:56tables, and bringing it all together in one sheet.
05:00So in the next lesson, we will look at creating a query using the design method.
05:05So from scratch, you have got a lot more options at your fingertips, but it can
05:10be a little bit more complicated.
05:12Let's look at that next.
Collapse this transcript
Creating a query from scratch
00:00When you're creating your queries in Microsoft Access using the Query Wizard,
00:04there may be times when you feel somewhat limited by your options.
00:07So we're going to look at creating a query from scratch now.
00:10In the previous lesson we used the Query Wizard to create a simple Select
00:14Query that goes in to one or more tables, allows us to select the fields that
00:19we want to display.
00:20Here's the results right here from the previous lesson.
00:22You can see that we took some fields from two different tables and we display
00:26them in a datasheet.
00:28Now, what if we want to do things like filter out certain record and use
00:31criteria to show only the information we need.
00:35Here's the scenario.
00:36We're giving an 80's party, so we want to get a list of all the songs from our
00:40database that are 80's.
00:42So that's what we're going to now.
00:44We're going to create this query from scratch.
00:46This is the result from the previous lesson.
00:48You can see I'm using Music Library 6a from the exercise files.
00:51We'll continue to use this particular database.
00:55I just want to pop over to Design View for a second now.
00:57So I'm going to click the Design View button and this is our Songs Query from
01:02the previous lesson.
01:03You can see we use two tables.
01:05Then we've got fields from each of those tables showing up down below, a
01:09simple Select Query.
01:10What you'll notice so is that there is no sorting going on, we have a
01:13Sort option down here.
01:15There is no criteria set for any of these fields, and that's we're going to do
01:19by creating our query from scratch, we're going to use some criteria, maybe even some sorting.
01:23So, let's do that.
01:25We'll go up to the Create tab and this time we'll skip pass the Query Wizard
01:30right over to Query Design.
01:32We'll give it a click.
01:33So right away, we're starting our new query.
01:35Here's the Show Table dialog box.
01:37It allows us to choose the tables we want to use in our query.
01:41Let's choose Songs.
01:42So I'm going to click Songs and Add.
01:45We may also want the performer name, so I'm going to click Performers and
01:48add that one as well. All right.
01:52Now, all we need to do is get the fields that we want to use down below into our
01:57design area, so I'm going to close this up, we're done selecting tables.
02:01I'm going to take Song Title.
02:02That's definitely information I'm going to want, and drag it down into the Field
02:07section down here and release.
02:09You can see that the Field chose up Song Title and the table it comes from also
02:13shows up down below.
02:14Now if I click in the next column, you can see there is a dropdown.
02:18If I click that, I'm going to see all of the fields in each of the tables
02:22showing up here as well.
02:24So that's another way to get a field into the right column.
02:28So, I've already got Song Title, let's go down to Performers and choose there First Name.
02:34We also should have the Performers' Last Name, if there happens to be one.
02:38So another way to get that down there is just to double-click Last Name.
02:41You can see it automatically fills in the next column.
02:44So this is the information I want displayed, but the field I want to set the
02:48criteria on is actually not showing yet.
02:52So I need to go back to my Songs table here and I'm just going to stretch it out
02:56so I can see all of the fields.
02:58It's the Decade that I want to use.
03:00So I am going to double-click Decade.
03:01You can see it shows up down here, by default, all of these fields will be
03:05showing in the results.
03:06I really don't need the Decade to show though, I want to choose all of the 80's
03:11music, but it doesn't have to say 80's all the way down to column.
03:14I know it's going to be 80's music.
03:16So I'm going to turn that off by clicking the checkbox.
03:19Now I'm going to set some criteria up.
03:21So right here in the Criteria row under Decade, I'm going to click in here and
03:26I'm going to start building my criteria.
03:28Now I could start typing here if I know what I'm doing, if I don't, I can get
03:32some help form the Expression Builder.
03:34So I'm going to come up here to the Builder button, give it a click.
03:38There is my Expression Builder.
03:39We saw this in a previous lesson.
03:41Now all I want to do is set up the Criteria, so that the Decade field from
03:45the Songs table equals 80's.So I can do that by coming down here to Tables
03:50and double-clicking. That expands it.
03:52We know that it comes from the Songs table, so I'm going to double-click Songs.
03:56That shows up now over here on the right.
03:58Decade, I'm going to double- click and look what happens here.
04:01It gets inserted into my Expression Builder.
04:04I can type in the Equal sign now or select it from here.
04:08So the Decade =, and I'm going to type in 80's.
04:11When I click OK, I will have written the actual Criteria.
04:18Now the cursor is still flashing here, if I want to continue entering
04:22more criteria, I could.
04:23I'm going to click down here.
04:25You can see the full string that shows up.
04:27Sometimes this part will get hidden and just the 80's will show up.
04:31That's the full Criteria as set up by using the Expression Builder.
04:37So, now I've got my criteria, I've got the fields that are going to be displayed
04:41in the results, all I have to do is run this.
04:44When I click Run, you can see the results.
04:48So here is the Song Title, there is the First Name and the Last Name.
04:52I know it's 80's, because in my Criteria, if want to be sure, of course, I can
04:57go back to Design View any time, I can click the Show checkbox here under
05:02Decade and run this again.
05:05You can see sure enough, it's all 80's down the right-hand side. All right.
05:08I'm just going to double-click here in between the columns to display all of the
05:15information in full width.
05:19There's my results from a Design Query that I created from scratch.
05:23Now, of course, it's very important that we save our work, if we don't do that,
05:30then we won't to able to go back to this query whenever we need it.
05:34Because, keep in mind, when we save our queries as we update our songs tables
05:38and our albums and so on over time and they start to grow, we'll add more
05:4280's music, obviously, well, next time we run the query, we'll see all of the new results.
05:47So let's go up to the Save button up here, we'll click Save.
05:50You can see the default name showing up is Query1 for me, I'm going to type in
05:5580's Music, and I'll click OK.
05:59You can see it now shows up over here under the Songs table as well as the
06:04Performers table, because we're using fields from both of these tables.
06:08I'll always have access to the 80's Music query just by double-clicking it, I'll
06:12always see the latest results, and over time, like I said, as we start adding
06:16more music, the results will grow automatically.
06:20So that's creating your own query from scratch using the Design mode, of course,
06:26the Query Wizard is another way.
06:27Let's talk about how we go back and make changes to a query, and we'll do
06:31that in the next lesson.
Collapse this transcript
Modifying a query in Design view
00:00By now you're starting to feel comfortable designing your own queries either
00:04using the Wizard or from scratch like we did in the previous lesson.
00:07Now we're going to look at going into an already existing query design and make some changes.
00:13So you can see up here at the top in the title bar that I'm using Music Library
00:166b from the Exercise Files.
00:18So to get all caught up with me go ahead and open that one up, and down below
00:23you'll see that I have double-clicked on 80s Music in the Performers table.
00:27This is a query we created in the previous lesson.
00:29You can double-click it in the Songs table or the Performers table to
00:33display the results.
00:34So now we've decided we're going to make a change to this.
00:37It might be nice to sort all of our song titles perhaps, and maybe add in a
00:41field and maybe some additional criteria, maybe even change up the order.
00:45So how do we do all that stuff?
00:47Well we definitely want to go into the Design View of the selected query.
00:51So with 80s Music selected, we go up to the Design View button.
00:57So there we have down below, the fields that are being used in our query.
01:01There's the one that's not showing, that's got the criteria.
01:04So that 80s is the actual criteria used for the decade in the Songs table.
01:10If we wanted to add a new field that's pretty simple.
01:13We just find the field and one of the two tables and add it by double-clicking
01:17or dragging it down.
01:18But what if we want to reorder things, so just an example, the year that it came out.
01:22I'm going to double-click Year Launched, and you can see it automatically gets
01:27added to the end here.
01:28But maybe it belongs before the actual first and last name.
01:32So if I wanted to, you can see by clicking just above Year Launched, I get that
01:36arrow pointing down.
01:37I can select the entire column.
01:39With it selected I can click and drag it until I see a line in between Song
01:43Title and First Name, and release.
01:46So there we have a re-ordered look at our query.
01:50Now we're going to add some criteria and some sorting options as well.
01:53I'd like everything sorted by the year that it came out.
01:57So in the Sort row over here, I'm going to slide over to Year Launched and click
02:01in the blank field which displays this drop-down for me.
02:04When I click that I can say Okay, Ascending or Descending.
02:07I'm going to choose Ascending.
02:10And now if I was to run the results here, I'd have the new field and the new
02:13sort option in there as well.
02:15But what if I want to change this query to include 70s music as well.
02:19Of course I'm going to have to rename the query to 70s and 80s Music, not just 80s Music.
02:24Let's go down here and you'll notice that under 80s, I've got an or field, and
02:29I'm going to click in there.
02:30And I could use the Expression Builder if I wanted to to add in some new
02:34criteria where decade could also equal the 70s, or I can just type in the way I
02:40see it up here and that is in double quotes, to type in 70s, just like that.
02:45All right I'm going to click outside, looks good.
02:49I should be able to run this query now to see the results.
02:52That's what I'm going to do.
02:54Clicking the Run button shows me the results.
02:56You can see the year that these songs came out, and that's the order
03:00that they're sorted.
03:01So from the oldest to the newest, and then you can see that I've also got all of
03:07the other fields that were selected.
03:09The one that's not showing is the Decade, cause we chose not to show that but it
03:13is being used for the criteria.
03:15So I'm getting 70s and 80s music now.
03:17Of course the name of this query is 80s Music, so it really doesn't make sense.
03:23I either have to rename this query to something else by using Save As, or if I
03:28wanted to I could go back and take the 70s part out.
03:32That's what I'm going to do.
03:32I'm going to go back to Design View, and I no longer want the 70s criteria.
03:37It doesn't make sense for this query.
03:39Let's simply highlight it by clicking and dragging and hitting Delete on the keyboard.
03:44All right, when I run it, the new results are only 80s songs, but still sorted
03:50by the year, and now I'm ready to save my changes.
03:54Coming up to the Save button and clicking Save is going to save all those design
03:57changes I made so this query is now up to date.
04:00Keep in mind, again now as we start adding more albums, more songs, more
04:05performers, any of the ones that are 80s that get added to our various tables
04:10will show up in this query every time we run it.
04:13So the results should grow over time.
04:16Now later on we're going to be talking about forms, and forms are the best way
04:19to input data, to be able to input data into more than one table at one time and
04:25to force people to input certain kinds of data and so on by giving them options.
04:29We'll talk all about that when we get to forms.
04:32For now let's just check out the results of our query, be happy with that, make
04:37sure we save our changes before moving on.
Collapse this transcript
Performing calculations on a group of records
00:00As you run Queries in Microsoft Access, it may be useful on occasion to get a
00:05running total of the number of records that are returned in a Query.
00:09For example here where we been running our Query called 80s Music in the
00:13previous lesson, it might be nice to see a total number of records that have
00:17been returned from our database based on some criteria that we set earlier on.
00:21And we can go down to the status bar down here and see that we're at record 1 of 9 for example.
00:26So there's a total of 9 records returned in this Query.
00:30But what if we want the total to show up maybe down here in the bottom row, so
00:33when we print the results we've got that total showing up right there.
00:37It's pretty easy to do, and I'm going to show you how.
00:39First of all, I'm using Music Library 6c.
00:43So go ahead and open that one up from your Exercise Files if you've got it and
00:47you'll be all caught up.
00:48I've double-clicked on the 80s Music query, so that's what you're seeing over
00:52here on the right-hand side, the results of the 80s query, and if I go over to
00:57the Design View by clicking the Design View button here, you'll see that the
01:01criteria under the Decade column is that we want all the songs where 80s shows
01:07up in the Decade field.
01:10So when we run this or switch to Datasheet View, we see those results.
01:13What we don't see is a total, and the total can show up at the very bottom
01:17here, simply by clicking the Totals button up here in the Records section of our ribbon.
01:22So when I click on Totals, you'll see that the word Total shows up here in
01:26the first column, and now I just simply have to select the field that I want to total up.
01:31In this case it really doesn't matter which one I choose, because I'm going to
01:34get a running total or account of all the records that show up here.
01:39So I'm going to click right in here next to Total, under the Year Launched
01:44column, and I'm going to click the drop-down and you can see my options here are None or Count.
01:48Now if it was a numeric field I might be able to sum up numbers for example, if
01:53I wanted to or average them out, but here I'm going to click Count, and right
01:57away you can see the number 9 shows up.
02:01So I'm going to click over here in another field so you can see that total.
02:06Now if we don't want the Totals row, no problem.
02:09We just click the same button, Totals button to turn it off.
02:12The next time we turn it back on everything we set up earlier is still there, so
02:16we do see a running total of 9 records in our 80s Music query.
02:21So that's all there is to running Totals.
02:24Now we can get deeper into totaling up columns and groups and so on.
02:29We'll do that later on when we get into reports, and those reports can be based
02:34on a query that we set up.
Collapse this transcript
Creating flexible queries
00:00It's time now to have a little bit of fun by adding flexibility to our queries,
00:05and it'll be easier for me to explain this if we look back at our previous
00:09scenario where we did create an actual query called 80s Music, and based on some
00:15criteria, it brought back all the songs in our library that were considered 80s.
00:20How did we do that?
00:21We set up criteria in the actual Decade field from the Songs table.
00:25It had to equal 80s, and you can see what happens.
00:28Now if we wanted to see a list of all of our 70s tunes, we would do another
00:32query perhaps where the decade would have to equal 70s.
00:35And the same thing again for 60s and the 90s and so on.
00:39So you can see we could end up with a lot of queries down the left-hand side
00:43here in our Navigation Pane, but another option is to create something called a
00:47Parameter query and that's where the user gets to input the criteria on the fly.
00:52So each time you run the query, you enter the new criteria and the results are
00:57different each time.
00:59So let's create a Parameter query now.
01:01It's very important though if you're following along and you have the Exercise
01:04Files, to open up Music Library 6d.
01:07What I've done is I've added some additional records, so if you want to be up to
01:11date, open up this one before you continue.
01:14Next we're going to go to the Create tab to create a brand-new query.
01:18We're going to do it from scratch so we come over here into the other section
01:21and click Query Design.
01:23All right let's choose a different scenario here.
01:26Let's say we want to be able to show a list of all of our rock songs, or all
01:32of our pop songs, or maybe whenever we need to show a list of all of our holiday songs.
01:36We're going to set up a Parameter Query that's going to prompt us for the Genre.
01:40So that's important to know ahead of time, when we select the tables that we're
01:44going to use in this query.
01:46So we definitely want the Songs table cause we want to be able to display the
01:49songs and it might be nice to show who performs those, so let's double-click
01:53Performers to add that table, and that's really all we need.
01:57We've got the Genre field over here that we can base our criteria on, and all
02:01the other information we want displayed.
02:03So I'm going to click Close over here on the Show Table dialog and now I'm going
02:07to choose some fields that I want displayed in the results.
02:11I definitely want the Song Title.
02:12I'm going to add the Decade.
02:16I also want to see the Performers first name and last name if there is one.
02:22So all of these results will be shown or displayed in the end result.
02:26But I want to base criteria on the Genre.
02:29So I'm going to double-click Genre over here, which adds it to the grid down below.
02:33But I'm going to base the criteria on this one.
02:35I don't necessarily need it to show up in the results, so I'm going to deselect
02:40the check box in the Show section, and down below in Criteria, instead of typing
02:45in equals rock or pop, I'm going to actually put in a message here for someone
02:50to enter that information, and it has to be in square brackets.
02:53So I start with the left square bracket.
02:55I'm going to type in
02:57 [Please type in a genre and I'm going to close it up with the right hand square bracket, and that's the message that will appear every time I run this query.] Let's test it out.
03:10We'll go up to the Run button here. (ph)
03:12I'll click Run, and look at that, a little dialog box appears saying,
03:16Please type in a genre.
03:18I'm going to type in Rock, and I'm going to click OK.
03:22And you can see the results.
03:24There's the Song Title, the Decade, First Name and Last Name if there is one,
03:28and all of this would be considered rock music based on the genre.
03:32Okay let's go back to the Design View.
03:35Again, we just entered the message in square brackets.
03:39If we run it again by the way, we can enter in a different criteria.
03:43How about holiday music?
03:45When I click OK, I get all the songs that would be considered holiday music.
03:51Obviously you're going to have to type in a genre that exists.
03:55So you have to know a little bit of, about the information in your tables.
03:59If you enter genre that doesn't exist, of course you won't get any results.
04:03Now, once we get into forms a little bit later on and reports, we can take this
04:07to the next step, and force people to enter valid data, valid options.
04:12But we'll save that for later.
04:13Right now let's continue with another Parameter Query.
04:16So I'm going to save this one.
04:18I'm going to call it Query by Genres, so I'm going to take out the 1, and click OK.
04:27Let's create another one and this time we're going to use two values.
04:31So we're going to go over to our Query Design, and let's say we want to be able
04:34to show a list of songs between certain years.
04:37So definitely we need the Songs table and that might be all we need.
04:41So we'll close this up.
04:42Now we want to see the Song Title, and we want to use the year that it came out
04:50as the Criteria field.
04:53So down below, we don't need to show the actual year it was launched, but we do
04:59want to put in the criteria, and this time it's going to be two options.
05:03So two boxes will show up.
05:05We're going to use greater than, so we put in the greater than sign, and then the message.
05:12So again in square brackets:
05:23Enter a start year, and then we close that up with a square bracket, then we put in the operator, which is and. (ph)
05:23So greater than and less than, and then we'll put in square brackets:
05:35Enter the end year and some more square brackets. (ph)
05:36Okay, so if we run this, let's see what it looks like.
05:41Enter a start year.
05:42I'm going to put in 1970 and I'm going to click OK.
05:47Right away another one shows up.
05:49Enter the end year.
05:50I'm going to put in 1990, and when I click OK, I see a list of all the songs.
05:57I'm just going to double-click here on the right to expand that.
05:59All of these songs fall between 1970 and 1990.
06:02Let's go back to the Design View, and just to prove it, we're going to add in
06:08the Year Launched, which is already here and click Show, and we'll run it again.
06:15Again we're prompted we can put in different values or the same values.
06:19When we click OK, we see the results and we show the year that it came out.
06:28Every one of these numbers falls between 1970 and 1990.
06:32Notice it's not really sorted in any way, so again we could go back to the Design View.
06:38You could say sort by the year in ascending order, and let's run it one more time.
06:45We'll type in some different criteria this time.
06:47How about 1980 as the start year and 2000 as the end year.
06:56So all of these now fall between 1980 and the year 2000, and you can see they (ph)
07:01are sorted by year as well.
07:04So this is one we would want to save.
07:06This one would be actually a Query by Year. We click OK.
07:11We've now got more than one query in here.
07:13You can see they show up in my Navigation Pane as well.
07:17And that's just an example of using a Parameter Query to add flexibility to your
07:21queries to display the results you need each and every time.
Collapse this transcript
7. Working with Forms
Introduction to forms
00:00It's time now to discuss Forms in Microsoft Access and the advantages of using
00:05Forms in your database.
00:07To this point, we've worked with Tables and Queries and another type of object
00:13in Microsoft Access is the Form.
00:15Now, I want you to think for a moment if you've ever signed up for anything
00:18online, where you're prompted for your information, maybe it's an e-newsletter
00:22or a membership of some kind.
00:24You're prompted for your own personal information you enter it into the
00:27appropriate fields, and you're only allowed access to that information.
00:31So that's one of the advantages of using a form.
00:34An Online Form is attached to some kind of database in the background where your
00:39information is stored in tables like we see here in Microsoft Access.
00:43The other advantage to Forms is that it makes it easy for the user to input
00:47information, edit existing information, and view any information that they
00:52should be allowed to view.
00:53Of course, you can hide the information they should not be viewing as well, by using a Form.
00:58So, so far we've been entering data straight into the table.
01:01We see all of the fields in that table, and all of the records of course.
01:06Well, with a Form, we can restrict that.
01:09So what we're going to do in this chapter is look at the different ways that we
01:12can create Forms in Microsoft Access.
01:14There's a built-in wizard to help us along.
01:16Of course we can go straight to Design View and create our Forms from scratch.
01:20Even then Access is going to give us a helping hand along the way.
01:24And then we're going to look at some more detailed functions like adding
01:28sub-Forms, a Form within a Form, and Command buttons, Split Forms, and the like.
01:33You'll notice here that I've got a database opened and if I look at the Title
01:37Bar, its Acme2007a, this is the one we're going to use.
01:41It's a brand new scenario now where we've got a customers table with
01:45customer information in it.
01:46Customers will be placing orders, so we see an Orders Table and then of course
01:52what are they ordering?
01:53Well, products from the Products Table.
01:55So we'll start in the next lesson by using the Form Wizard to create a brand new
02:00form that allows us to enter products into the Products Table and review, and
02:04edit that information as well.
Collapse this transcript
Creating forms with the Form wizard
00:03It's time to create our first Form in Microsoft Access and we are going to use
00:06the Form Wizard to do it.
00:09You can see here I have got Acme2007a opened.
00:12It's from the Lesson 7 folder of the Exercise Files.
00:16So if you want to follow along and you have got the Exercise Files, go ahead and
00:19open up this database.
00:21I am currently in the Relationships view right here, so you can see that we have
00:25got three tables Customers, Orders, and Products.
00:28You can see the primary key over here in the Customers table.
00:31There is the Customer ID, which shows up in my Orders table.
00:35Hopefully, it shows up in the Orders table many times if I want to stay in
00:38business and then you can see in the Products table here, I have got a Product
00:41ID and the Name, Unit Price, and Description, and this will show up many times
00:46in the Orders table as many customers will order this product over and over. We hope of course.
00:52Now, the Order Number in the Orders table is also a primary key, so we can keep
00:56track of all of our orders.
00:58The reason that we are going with this new scenario, you can see we have got a
01:01Unit Price now and there is a quantity in the Orders table.
01:04We may want to be doing some calculations with this data a little bit later on.
01:08So we change scenarios here to something a little more professional.
01:12So the next step is to create a Form that a user will actually make use of to enter products.
01:18So to either edit existing products, review the products in the Products Table,
01:22or add new products as they come along.
01:25So what we are going to do first is come over to the Navigation Pane here and
01:29you can see All Tables is selected.
01:31So make sure that All Tables is selected here.
01:34We are going to start with the Products table, so it is a good idea to select it
01:38first before going up to the Create tab here on the Ribbon and we are going to
01:43create a Form, so we are going to be in the Forms section here.
01:45You will notice there is nothing that really shows up here that says Form Wizard.
01:49It is kind of hiding over here under More Forms.
01:52So we can create a basic Form.
01:54This is a Form that will of course let you enter information for one record at a time.
01:59There is something called the Split Form.
02:01We are going to look at this a little bit later on.
02:03It is kind of a Datasheet View, and there is two sections, an upper and a lower section.
02:07We have got Multiple Items, which is kind of like a Datasheet View with a table.
02:12And then there is our Form Design button that we will look at in the next lesson.
02:15For now we are going to go to the Form Wizard to get it started and it is
02:19hiding under More Forms.
02:20So we will click on the Form Wizard and you can see the Form Wizard dialog box launches here.
02:27The Table called Products is already showing up here, because we selected it
02:31ahead of time from our Navigation Pane.
02:33Now, you can see the fields that are available in this table.
02:36So remember what I was saying earlier that we can restrict what information can
02:41be viewed or edited or even entered by using a Form.
02:45Well, we can use any or all of these fields in our Form.
02:48Now, for our purposes we do want them all.
02:51So I can click this double arrow to move them all over to the Selected Fields box.
02:56I am ready to move on. I click Next.
02:59Now, we can choose a look for our Form and you can see by default, we have got Columnar.
03:03So we have got columns of data showing up here.
03:06Tabular is more like the Datasheet View.
03:09So as Datasheet, similar to what we are used to seeing in our Tables.
03:14And then we have got something called Justified, which kind of formats our
03:17fields around the screen.
03:19So let's go back to the first one Columnar and we will hit Next.
03:24Now, we are going to choose a style.
03:25So we can go through the styles and see a little preview over here on the left
03:29of what that style looks like.
03:30Some nice looks and there is quite a long list.
03:35You can see as we scroll down.
03:37There is lots to choose from.
03:40I am going to go down to Windows Vista down here and click Next.
03:45Now, we can give our Form a title.
03:47So Products is showing up here because it is using the Products table.
03:50That's probably just fine.
03:52You can add text, change what is there by highlighting and typing over. It is up to you.
03:56I am going to leave the default of Products in there and that's all the
04:00information that the Wizard actually needs.
04:01Do we want to open the Form or modify the design next?
04:05And you can see by default, Open the Form to view or enter information
04:08is already selected.
04:10If we want to go further and modify the Form's design, so we are not exactly
04:14keen on what the Wizard has given us, we can go in and modify that design, but
04:18we can do that anytime.
04:19So for now, we will leave it at Open the Form to view or enter information,
04:23we will click Finish.
04:26So now you can see that we are actually in the Products Form.
04:29I have got a tab here.
04:30The Relationships tab is still there.
04:32Well, we are in the Products Form.
04:33We are seeing one record per screen.
04:36So Product ID number 1 is a 12 inch LCD monitor.
04:39You can see the price and the description.
04:41Now, we can move around through these various records.
04:44Down at the bottom of the Form, you can see on the Status Bar we have got
04:48Navigation buttons to take us to the next record and we can move through the
04:52records like that if we see something that needs to be changed.
04:55We can just go in and change it.
04:57We can go right to the very end, the last record or back to the very beginning
05:02using the first record button.
05:04If we want to enter something new, we come over here to that New Blank Record button.
05:10The Product ID, if we try to type something in here, you can see nothing happens.
05:15It's because it's an auto number field.
05:17It's automatically going to increment for us by 1.
05:20So we can tab into the Product Name.
05:23Here is where we give our product a name.
05:25So let's actually enter something here.
05:27We will enter a piece of computer equipment. Let's do Scanner.
05:36Unit Price, we'll put it in at $49.99 and when we hit Tab, see how it changes
05:42to a Currency field.
05:43That's because that was set up in the Table and in the Description we will put,
05:46USB Flatbed Scanner.
05:50There we go.
05:56Hitting Tab will take us to another new record.
05:58We don't need to enter anything at this point, but you can see now we are up
06:01to 12 records down at the bottom and that's thanks to the Form we were able to
06:05enter that new record without looking at the entire table and the entire datasheet.
06:10So that's a very simple Form using an existing table and making use of the Form
06:16Wizard to create it for us.
06:17In the next lesson, we will create a similar Form, but we will do it from
06:21scratch using Design view, and then we will take it a step further with some
06:24more design elements.
Collapse this transcript
Creating forms from the Design view
00:00Well we saw in the previous lesson just how easy it is to create a brand new
00:04form in Microsoft Access, with a little help from the Form Wizard.
00:08Now we are going to go about creating a form a different way that by the way
00:11is equally as easy.
00:12We are going to base it on a different table though.
00:15So the first thing if you are following along and you skipped to this lesson,
00:18you will need to open up the Acme 2007b:
00:21Database from the lesson_07 folder of your exercise_files.
00:24The next thing you are going to do is click on the table that we are going to
00:28create the form from.
00:30So I am going to click on the Customers:
00:31Table over here in the Navigation Pane.
00:34That's important before clicking the Create tab and going to Forms section, you
00:38want to have the right table selected, because the form you create using this
00:42method will be based on the selected table.
00:45Now here are the Form buttons.
00:46You can see we've got a Form button here and this is going to create a very
00:49simple form similar to the one we have down below that was created using the wizard.
00:54It lets us enter information one record at a time.
00:56A Split Form, we are going to talk about a little bit later on is kind of cool
00:59because, the form actually shows up at the bottom of the screen and then there
01:03is a data sheet in the upper section so that we can actually enter information
01:08about the selected record in the related data sheet.
01:11Multiple Items is similar to a Data Sheet View, I am actually going into the
01:15table and entering records or information, except that with a form, we can limit
01:20the fields that show up in this view.
01:21We can create a blank form right from the scratch and a little bit later we will
01:26go back to the Form Design to make some changes to an existing form.
01:30We access the Form Wizard, from the More Forms button.
01:33So now we are going to use one of these three options, we are going to go to the
01:36very first one Form, and with the Customers:
01:38Table selected when we click the Form button, watch this.
01:41It's very quick, the Customers form has been created and it's based on the Customers:
01:47Table and its relationship.
01:50Look down at the bottom here.
01:51You can see we have got all of the customer information listed here, and then
01:55down at the bottom, we have got a data sheet of the related table which is the Orders: Table.
02:00So I can see customer information in here, and order information for that customer.
02:06Now if the customer doesn't have any orders this will be blank down below.
02:10But I can actually enter orders right from the customers form as well as add new customers.
02:15It's kind of interesting.
02:17The other thing that's happened here is that we are brought directly into what's
02:20called Layout View, and we can change the layout of our dorm now.
02:24So unlike the Wizard, we don't get to choose a style, we didn't get to choose an
02:29actual layout but we can make changes ourselves now.
02:32If we wanted to for example, move these fields around, we can.
02:35You can see there is a little four-sided arrow up here and when I click on it,
02:39all of those fields get selected and I can move that up.
02:41For example, if I want to bring it little higher towards the top and leave more
02:45space between it and my data sheet and then I have got all of these options up
02:49here for changing the fonts, the appearance, the sizes and even the alignment if I wanted to.
02:56Over here in Formatting if I click in one of these fields, you can see I can
03:00format the field, if it should be, for example, down here a Currency Format, I could do that.
03:06Here's number, a zip code.
03:07Notice that the Formatting disappears if it's not a numeric field.
03:11If I come up here to the Customer ID, I can't change the Formatting, I can add
03:16Gridlines, I can put in a Logo, I can add a title to this form.
03:21You can see Customers is the default here, based on the name of the newly
03:26created form, now it hasn't been saved yet.
03:29You will notice it doesn't show up over here in the Navigation Pane until we save it.
03:32There's all kinds of things, including Auto Format.
03:34I am going to click on this first one, in Auto Format and this is an Access 2003
03:40Format that you are looking at here.
03:42If I go over to the other one, it's an Access 2007 Format and that's what was
03:47created by default for me.
03:48And we are going to get into formatting and modifying the design of your forms
03:52and so on, but for now we have got our brand new Customers:
03:55Table, we are in Layout View.
03:57To change to another view we can go to the View button here.
04:00Click on Form View and this is the view that we would use to actually view our
04:05data, edit existing data or even come down here and add new data, if we wanted
04:10to add new records for example.
04:11As soon as new customers come on board, we can enter them using this form.
04:15Now all of the rules that apply to the underlying table apply in the form.
04:20So if we set up any validation rules for examples in a table, then they will
04:25exist here as we enter data into the form.
04:28So let's save our changes and go up to the Save button up here.
04:33By default the name is Customers as the Form Name, because it's related to
04:36the customers table.
04:38That's fine with me, so I am going to click OK.
04:40And you can see now that the Customers form does show up over here on the
04:43left-hand side on the Navigation Pane.
04:46So another extremely easy way to create a form.
04:50It's a quick and dirty format.
04:51So if we need to make changes and change up the design or the layout, we can do
04:55that and that's exactly what we are going to do in the next lesson.
Collapse this transcript
Modifying a form's design
00:00Now that you are comfortable with a couple of different methods for creating
00:03forms in Microsoft Access, we are going to look at modifying the design of an existing form.
00:10When we created the form in the previous lesson or even when we used the form
00:14wizard, there were a couple of options at our disposal for selecting the way our
00:18form was going to appear, but there was not a lot of flexibility built into the
00:22actual design process of the form.
00:25We accepted many, many defaults.
00:27For example, here this Customers form you can see has the word Customers in the title.
00:31That's based on the table customers.
00:33The logo is simply the icon that Access users were form.
00:38Then down below you could see the fields in the detail section.
00:42Automatically this table was added for us at the bottom and there is nothing
00:46really else past that except for the navigation buttons for moving through
00:50the different records.
00:51All right, so what if we want to change up this design, maybe improve upon it.
00:57No, problem all we need to do is change the view to Design view.
01:01That's what we are going to do right now.
01:03You will notice up here in the title bar, I am using a database called Acme2007c
01:07from the Lesson07 folder of the Exercise Files.
01:10So if you are jumping to this lesson, no problem.
01:13You can open that one up and double-click the Customers form and switch to
01:17the actual form view.
01:20Now if you have been following along in the previous lessons and you are in the
01:23right spot, you can just continue working on the existing form.
01:26All we are going to do now is improve upon the design of our Customers form by
01:30going up to the View button up here on the ribbon, click the dropdown, we are
01:34going to change from Form View to Design View.
01:37As soon as we do that, you can see some things happen.
01:40First of all, we have got sections, we have got a Form Header and in the header,
01:44we have got our logo and our title so far.
01:46We've got a detail section containing the fields that are used in our form.
01:51Obviously, they relate back to the Customers table.
01:53There is the Orders table that was inserted for us and there is also a Form
01:58Footer section down below.
01:59You will notice a ruler down the left hand side, a vertical one as well as a
02:04ruler across the top and this will help us when we are trying to line objects up.
02:08All right, I am going to scroll all the way back up to the top and show you
02:13what's happening on the ribbon as well.
02:14Now as soon as we change to Design View, you can see the Form Design Tools area
02:20is shaded up here in the title bar and I have got two tabs that fall under that,
02:24Design and Arrange and each of these tabs contains a number of Tools to help me
02:29with the modification of the design of this form.
02:33On the Design tab, you can see I have got Font Options, Gridlines, then I have
02:39got Controls here, all kinds of things that can be added including logos, text
02:44boxes, buttons that we are going to talk about later on, graphics and so on.
02:48We have also got Tools over here on the right hand side to add existing fields
02:53and look at the property sheet, etcetera.
02:55Now if we go to the Arrange tab, you can see we have got a number of things here
02:58including AutoFormat that might come in handy.
03:01We can change the layout here, we have got Control Layout altogether, so some
03:06built-in options for us, Tabular, Stacked, Remove.
03:10We have got Control Margins and Padding, Snapping to the grid, changing the tab
03:15order, all kinds of things.
03:17We can control alignment, size, position and we have got some Shows/Hide buttons
03:24as well, to show rulers or item, gridlines, etcetera.
03:27I am going to start with the Design tab and we are going to start with our Form Header.
03:33Here we have the logo that was created for us and it's simply the icon that
03:37represents a form in Microsoft Access.
03:39We are going to change that and the easiest way to change a logo is just to
03:42click the Logo button right here.
03:44You can see it highlighted the logo and then it took us to the Insert
03:49Picture dialog box.
03:50All we need to do now is go and find our logo and I am going to that now, I am
03:55going to go to my Exercise Files, so you we can do the same, double-click the
04:00Lesson07 folder and you will see a logo in there that we can use.
04:04It's a capital letter A. We will click OK.
04:08So the old logo is replaced with the new.
04:10I am going to size it by going to one of the sizing handles here, I am going
04:14to make it larger just like so and now I am going to change up our title area as well.
04:20Customers is fine, but I want to add a little bit.
04:23As soon as I click in this area, you can see now it's highlighted, the logo is
04:26no longer highlighted, and I can click inside here, right before Customers and
04:31just type in Acme like so.
04:36When I click outside that area, it's locked in and you can see I have already
04:40made some nice changes to the design of my form.
04:44Now if we look over to the right and use the scrollbar down at the bottom to
04:48scroll over to the right, its fields are very wide, so is this area up here,
04:53come to Title and if we scroll down, a table called Orders that was inserted for
04:58us also goes to the very edge of the form.
05:01We can change the size of our form and to do that, we need to change the size of
05:06our fields and so on, all of the objects inside the form.
05:09I am going to start down here by clicking on the table called Orders and as soon
05:13as I can see this little handle over here and I get the double arrow, I can just
05:17drag it inwards to make it a little bit smaller.
05:19I don't need it to be that wide.
05:21I am going to go to the 6-inch mark and I am going to scroll up now.
05:24Now all these fields are related, so when I click in anyone of them and I drag
05:29the right hand border into the 6-inch mark, all of them move in. That's handy.
05:34I am going to scroll up.
05:37Click on this Title area and do the exact same thing when I see the double
05:40arrow, drag it into the 6-inch mark.
05:44That means now that I can go to the edge of my form.
05:47Drag it in as well.
05:49I am going to drag it into close to the 6 inch mark, give a little bit of
05:53space on the outside.
05:54Now, I have changed the size at least the width of my form.
05:58So that might be a little bit easier to work with.
06:02I don't need all this space for the first name, last name, street, etcetera. Okay.
06:07What about the look of our form now?
06:09The background, the colors, the font, etcetera, that are used.
06:13Well, for that we might want to switch over to the Arrange tab.
06:17We have got some AutoFormat options here.
06:19I am going to click this little dropdown and you may have remembered this from
06:24creating a form using a wizard.
06:25We had a lot of options and these are them for the look of our form.
06:29So I kind of like this one down here as I hover over it. It says technique.
06:33I am going to click on it, which is going to change the look of my actual form.
06:39There is a lot of other things that we could do and we'll save some of them for
06:43later on including Command buttons, and labels and so on, but right now, I am
06:48almost satisfied with this title which is currently selected by the way.
06:52I might want to change the font and I can do that from the Font section.
06:56So right now you can see the font that's being used.
06:59I can click the dropdown and choose something that might look a little bit nicer.
07:05I like this one right here, the alignments on the left. That's fine.
07:10The size could be a little bit bigger.
07:12I'm going to go up to 20 and that looks great.
07:16Now I am going to keep the colors because color combinations are fine, based on
07:21style that I selected a moment ago.
07:23I'm going to click outside that area to deselect and see what that looks like.
07:27Now when I switch to Form View, I am going to have a totally different look
07:30then when I started.
07:32So here's our new form.
07:33You can see that looks pretty good.
07:35Fields aren't so wide, a little bit easier to look at and manage, so I scroll
07:40down, I still got the Orders table in there.
07:42That's great, each of them with their own navigation buttons.
07:46Right, so those are some basic changes that we can make to a Form's design.
07:51We are going to go deeper into this as we go through the various lessons in this
07:54chapter including some of those command buttons, restricting the type of
07:59information that can go into fields and so on.
08:01But you should have a good handle now on how to make some basic changes or
08:05modify your Form's design.
Collapse this transcript
Creating subforms
00:00As we continue our work with forms in Microsoft Access, we are going to look at
00:04another feature to make it even more convenient for you to add records to
00:08tables using forms.
00:10Now a few lessons when we created a Customers form, the one you see here on the
00:15screen, before we modified it, something happen for us automatically, when we
00:19chose one of the Prefab options for creating form.
00:22The Orders table appeared at the bottom of this form because we use the
00:26Customers tables to create this form and the Orders was a related table.
00:31So that's very convenient for us as we scroll through the various customers in
00:34this form to see all of their orders in a table below.
00:38Well we already know that forms are kind of like windows into the various data
00:43in the various tables in your database.
00:45So why not put a form at the bottom of our form.
00:47In other words nest it right inside the existing form. We can do that.
00:51It's called the subform.
00:53So what we are going to do with an existing form is nest another form inside of
00:58it to change its appearance to make it easier to work with.
01:01All right the first thing that we need to do though is to open up Acme2007d from
01:07the Lesson07 folder of your Exercise Files.
01:09As a matter if you are following along, go ahead and open up this one if you
01:12have the Exercise Files.
01:13So we are all starting on the same page.
01:16The next thing we are going to do is create a new form for the Orders Table,
01:20right now there isn't one.
01:21So when we click on the Orders Table, and we go up to the Create tab, we are
01:26going to click on Multiple Items.
01:28This is a form that kind of looks like a datasheet.
01:31So we are going to go choose Multiple Items, and you can see that was
01:34pretty quick and easy.
01:36There is our Orders table.
01:37You can see we have got three orders in there already.
01:40And we are looking at the form version of this table.
01:43So it looks very familiar.
01:44It's kind of like a datasheet because the records are in rows from left to right.
01:49All right we need to save this.
01:51We are going to save it, keeping the default name, which is Orders. We click OK.
01:56You can see it gets added underneath the Orders table, here on the Navigation Pane.
02:00All right so we are going to switch back to the Customers form now, and we are
02:05going into Design View.
02:07So we go up to the View button, come down to Design View.
02:10We have been here before and we are going to scroll down where the Orders table appears.
02:16I am going to click on it and hit Delete on the keyboard.
02:20It's gone just like that.
02:22Now all we need to do is get the Orders form in here instead and we do that by
02:26coming over to the Navigation Pane, clicking and dragging the Orders form right
02:31down here into the existing form.
02:34Now obviously where we drop it is important.
02:37So I am going to drag it over and up to the left like so.
02:41We are even going to squeeze it in here on the left and because of where I
02:45dropped it you can see that the form actually grew to accommodate it.
02:49I can drag that back in right about there.
02:52That looks good and now I am going to have the Orders form instead of the table
02:56showing up at the bottom.
02:57So let's save this form called Customers and let's change our view now to the
03:03Form View, and you can see what happens, this looks a lot nicer, down below.
03:07I have actually got the Orders form showing up.
03:11You can see I can move through those orders using these Navigation buttons.
03:16I move through the various customers using the Navigation buttons down at the bottom.
03:22Now the neat thing is not only can I view this data, but I can actually add new
03:27orders right here in the Orders form for example.
03:30If I want to add new customers, I can add new customers.
03:33And I can do it all from one screen.
03:35This makes it very, very convenient for me as I am working with both customers
03:39and orders at the same time.
03:40All right, now there is another way for you to nest a form inside another form
03:45or another words create a subform and that's using the Form Wizard.
03:50So that's what we are going to do next.
03:52I am going to go up to the Create tab.
03:54We are going to go to the Form Wizard.
03:56Now before we do that let's create another Customers form.
03:59We are going to go click on Customers Table right here in the Navigation Pane.
04:04I am going to click on More Forms.
04:05I am going to choose Form Wizard.
04:07You can see that the table called Customers is selected by default.
04:12Well if we wanted all of those fields except for the id, we can move that one back.
04:19We can also add another form, watch this. Click Next.
04:22Columnar is the option that we want.
04:25But when I go back and choose my Orders table.
04:29You can see all of those fields become available, and I can add those as well.
04:34When I click Next, look what happens.
04:37How do you want to view your data?
04:38Well I want to view it By Customers, which means that the Orders table or in
04:43this case Orders form would be the subform.
04:45Form with subform is selected down below.
04:49When I click Next, I am back to my two options, which are changed now,
04:53Tabular or Datasheet.
04:55I am going to Tabular.
04:57Click Next, now I get to choose a style.
05:01I am going to go leave it at Technique. Click Next.
05:04We can see I am going to have Customers 1 and the Orders Subform.
05:10I am going to leave those titles for now I know I can go back and modify
05:13the design at any time.
05:14When I click Finish, I am going to see the end result.
05:18So there it is very similar to what we had by modifying our own form design.
05:22So there is Customers, down below are the orders for that customer.
05:28So when I close this, it shows up over here as Orders Subform and Customers 1.
05:35If I don't want those, I kind of like my own design here, I can right-click in
05:39this case Customers 1 and choose Delete.
05:43I will need to confirm by clicking Yes.
05:46Remember deleting the form does not actually delete any data.
05:50The data is still in the table that it's related to.
05:53The Orders Subform can also be deleted with a right-click and a confirmation Yes.
06:00So a couple of different ways to create subforms.
06:02You can do it yourself or via the wizard either way, what you have done is you
06:07have created a convenient way for you to look at the data in more than one table at one time.
06:13You can modify that data and even add new data all from one screen.
Collapse this transcript
Adding command buttons to a form
00:00Here's where we get to have a little bit of fun with our forms in Microsoft Access.
00:04We're going to add a Command button to our form, and this is just going to make
00:09life even more convenient for the user who has to use this from to either view,
00:14edit, or input data into a table though this form.
00:18So here's a typical scenario, maybe on occasion as we go through the various
00:23customers in our Customers form here, we want to print out the data that we see
00:27on our screen, in other words print the form the way see it.
00:30Well, we can add a button that it makes it very convenient for that person to
00:34just print the current form.
00:35Now, how do we do that?
00:37Well, we need to go into Design View.
00:39First thing you'll notice up here on the Title Bar is that I'm using a database
00:42called Acme2007e, I got it from the Lesson 7 folder of the Exercise_Files.
00:47If you are jumping to this lesson, this is the one you'll want to open up.
00:51If you're following along from previous lesson, you're okay with what you've got.
00:55So once you are in you want to double- click the Customers form over here, and
01:01then we want to go up to the View button, and select Design view.
01:06Okay, so the very first thing I need to do is create some room on the right if I
01:09want to put my button over here.
01:10So I'm going to go to the right-hand side of the form and on the background here
01:14I'm going to drag it out to about the 7-inch mark right there.
01:17Now I've got space for buttons if I want to put them in.
01:20To add a button, well we can go up to the Control section here and you'll notice
01:24that I've got a number of options.
01:27I've got Text Box, and Labels, and then there it is.
01:30Here's where I go to add a Form Control button.
01:33I've got other Form Controls in here like Combo Boxes.
01:37I've got List Boxes.
01:39You even see Subform/Subreport.
01:41All kinds of cool things that we'll talk about later on.
01:44Right now, we're going to focus on adding a button, and I want you to
01:47know what's over here.
01:48Something very important in the Control section is that these two buttons are selected.
01:53So the very first one is Select, when I move around here you can see that my
01:56mouse pointer is a Select icon so I can go in here and start selecting things.
02:02The other thing that's on is Control Wizards.
02:06That means when I come over here and click this button I'm going to launch some
02:10kind of wizard, same thing for any of these other controls as well.
02:14So I'm going to click on the Button and all I have to do now is draw my
02:20button where I want it.
02:22So watch what happens when I come over here and I just click-and-drag to draw a button.
02:26The Command Button Wizard shows up by default and that's because this is enabled
02:32over here in the Control section of my ribbon.
02:34All right, so what is this button going to do?
02:37You can see that there are number of Categories down in the left and then
02:40Actions for the selected category.
02:42Well, right now Record Navigation is the selected Category.
02:45That means I can create a Find Button, to Find Next, Find a Record, I can
02:50create Go To buttons.
02:52Any of these can be used on this button as a command.
02:56I also have Record Operations.
02:58So if I wanted to create a button for adding New Records, I could do that.
03:02How about Deleting Records or Duplicating Records?
03:05There's one to Print a Record.
03:08Save and Undo are also Record Operations.
03:11Then I've got Form Operations under Categories. Look at this.
03:14Apply a Form Filter, Close or Open a Form, Print a Form.
03:18I have got Print a form and I've also got Print Current Form, two different things.
03:24And Refresh Form Data.
03:25Report Operations, so if I wanted to Mail Reports, or Open Reports, Preview, etcetera.
03:32Application is the next category.
03:35I can create a Quit button here that quits the whole thing.
03:38And then Miscellaneous has some Macro stuff and Table stuff.
03:41So we want to go back to back to Form Operations because that's where we saw
03:44Print Current Form, we'll click Next.
03:47Now our options are, do we want Text on the button or a Picture of a Printer on the button?
03:52Well, if I click the Browse button with Picture selected, I can go browsing for
03:58Bitmaps that I want to use, I'm going to click Cancel.
04:01I can also Show All Pictures, right now it's Printer that is selected that's why
04:05we're seeing a sample over here.
04:07Show All Pictures shows me things like Properties, Preview, and you see the icon
04:12over here in the Sample area.
04:15But really I shouldn't be showing them all.
04:18It's really the Printer one that I want because this command is going to
04:21print my actual form.
04:23When I click Next, I get to name my button.
04:28So right now it's just showing up for me as Command21.
04:31You may have a different number showing up there, depends on if you've done
04:34any of these before.
04:35It really doesn't matter, once there we're going to put in our own information
04:38so that when we'll go back into Design View we know what this button is doing.
04:42It's Printing Current Form, good.
04:47When I click Finish, there is my icon.
04:50I can resize this now that the picture has been selected.
04:55That's a good size right there.
04:56And to see if this works I'm going to back to my Form View.
05:01There is my button as I scroll through the various customers and I decide this
05:06is the one that I want to print, I can come up to my Print button.
05:09It says Print Form.
05:11When I give it a click the Print dialog box shows up, clicking OK would
05:14send this to my printer.
05:16So I'm going to click Cancel.
05:18I will not actually print it this time.
05:20But it looks like we just created some convenience for our users by
05:24offering them a Command button in this case that will print the current
05:27record, or current form.
05:29So you can see there's a number of Commands and different Categories that we add.
05:34We add Save buttons, and Close buttons.
05:36You can rearrange using your form design exactly where these buttons go in
05:40accordance with the various fields in your form and so on.
05:44Design is totally up to you and now you can also create added convenience for
05:48the users who have to use these forms to input, or modify data by adding Command
05:53buttons wherever you like on the form.
Collapse this transcript
Sorting and filtering with forms
00:00It was quite a few lessons ago when we first explored some of the sorting and
00:04filtering options in Microsoft Access 2007.
00:07It was while we were working with tables.
00:09Well, now that we're working in Forms, the same sorting and filtering options
00:13available in Access apply here.
00:15So, that's what we're going to do.
00:17First thing you need to do though is open up Acme2007f from the Lesson7 folder
00:22of your Exercise Files.
00:23This is an updated database with some additional records that will help us as we
00:27go through some sorting and filtering options now.
00:30I've double-clicked, the Customers form to open it up, and you can see by the
00:34very bottom of my form here, I'm at record 1 of 6.
00:37This is the first record that went in to my database.
00:41Now, the order that the records appear are simply chronological.
00:45As they get entered, that's the order that they appear.
00:48Now if we want to change that order up, you'll notice that up here on the ribbon
00:51we've got a Sort and Filter section just like we did when we're working with
00:55tables and the same thing applies here as we work with forms.
00:58So if I want to sort for example, by State, I could come in here to the
01:01State field and I'm going to either Ascending or Descending, I'm going to choose Ascending.
01:07All right, so here we are at Record 1, as I move through, you can see the
01:12next one is Oregon, OR.
01:15As we move through to the next one there's a P, another P, another PA and we
01:22end up with Wisconsin.
01:24So, we've sorted alphabetically on the State because we clicked in the field
01:27first and then applied the Sort button.
01:29Now, if we were to click the Descending order, you can see now that Record 1 is
01:35actually this one Claire Lucille form Wisconsin.
01:37As I move through the different records, they are now sorted in descending
01:42order by the State.
01:44So that can be handy.
01:45Now even handier might be ability to focus in on a specific group of record
01:50and that's filtering.
01:51And before we start filtering, let's look at this last button down here, Clear
01:56All Sorts, and return to our original state, which is a chronological order, and
02:00just click this button at the very bottom.
02:03Now let's say we want to focus in on just those records or just those customers
02:07who live in the State of Pennsylvania.
02:10Well again, I would go to the State field and then come up to my Filter button.
02:15You'll notice right away because I've clicked in the State field, all of
02:18my States appear here.
02:20So, any customer who has information in the State field is either going to be
02:24California, Oregon, Pennsylvania or Wisconsin.
02:27So, I choose the States that I want to view.
02:31Now, the Select All checkbox, by it clicking it deselects all.
02:35So I'm going to deselect all and just select PA.
02:39You can see down at the bottom, I'm at Record 1 of only 3 now, so the number of
02:43records just got cut in half.
02:45And as I move through those records, you'll see that each one them belongs to
02:49the State of Pennsylvania.
02:50All right, you'll also notice up here in the Sort and Filter section that the
02:56Toggle Filter button has now been highlighted.
02:59That means we can turn off the Filter by clicking it, we're back to 6 records now.
03:05And if we want to quickly go back, we click the Toggle Filter button.
03:08You can see that Filtered now appears down here on my Status Bar, and I'm back
03:12to those three records for the State of Pennsylvania.
03:15So I'm going to turn that off and look at some options.
03:19Again, I'm going to click in the State field and you'll notice that there is a
03:22Selection button and an Advanced button.
03:24I'm going to click on Selection.
03:26Here's where we get to choose Equals, Does Not Equal, Contains, or Does Not
03:31Contain, in this case CA because I clicked in the State field in my particular
03:36record where the State equals CA.
03:38So, if I want to see everyone who's not in the State of California, I would
03:42choose Does Not Equal CA.
03:43So, you can see that's 5 of my 6 records down below.
03:48Again, the Toggle Filter button is highlighted so I can turn off that filter and
03:52go back to it with the same click, at any time.
03:54All right, let's go into the State field again.
03:58We'll Go to our Selection and say Equals CA.
04:02As soon as I see that, you can see there's only one customer in the State of California.
04:07And we'll turn that off.
04:08Now if I move to another record where I've got the State equaling PA and click in there.
04:14Now, when I go to my Selection button, you can see its Equals PA, Does Not Equal PA etcetera.
04:21So, if I want to see everyone who's not in the State of Pennsylvania, I
04:24can click here, three of them are not, there's one in California, Oregon and Wisconsin.
04:29I'll Toggle that off, and we're back to our original set of records.
04:35Now, let's go to the Advanced.
04:36Now, I'm going to click on Advanced right now.
04:38You can see I can Clear All Fliters, I can Filter By Form, and this is interesting.
04:42I can Apply a Filter/Sort that I've selected, and then I've also got an
04:46Advanced option down here.
04:48I'm going to go up to Filter By Form.
04:51Now it kind of looks funny here because you can see the last thing I did was
04:56Not Equal to PA, and that shows up here.
04:58I've got a drop-down now in the State field, where I can choose different states.
05:04So there it is.
05:04If I toggle the filter, you can see there's only one in the State of Wisconsin,
05:10and that's another way to do it.
05:11I'm going to turn that off.
05:14Let's go back now to the Advanced button Filter By Form.
05:18I'm going to click on this drop-down here.
05:20I am going to choose PA.
05:22But then I'm going to take it a step further.
05:24I want the City of Manotick, so I can actually type in an M as in Manotick,
05:30automatically that shows up.
05:32I could have went to the drop-down to see a list of all the different cities
05:35that my existing customer list live in.
05:38So I'm going to use Manotick.
05:38I'm going to toggle that.
05:41You could see there's two in Manotick, PA, and I can sort through.
05:46So it just narrows down the fields, so if need to work on a specific group of
05:50records, I can quickly filter down to that group of records and at anytime
05:54return back to the full list.
05:57So keep in mind the Toggle Filter button, it will take you back to your previous
06:00filter at anytime, and if you want to change it up, you've the Filter option.
06:05You've got the Selection button and of course using Advanced, you can Filter By Form.
06:09I'm going to turn that off, return to my original list, and that covers
06:14Sorting and Filtering.
Collapse this transcript
Switchboards vs. the Navigation pane
00:01You may be familiar with switchboards and a switchboard is really just a
00:04form but with buttons or links on it that enable the user to navigate around the database.
00:10Here is an example of a simple one that allows users to add customers, products,
00:14and orders into the various tables.
00:17You will notice there is no button here for modifying the database design
00:21or running reports.
00:23As a designer, I have really good control over what a user can or cannot do
00:28through the switchboard.
00:30Now the Switchboard in the past would make special use of something called the
00:33Database Window in previous versions of Access.
00:36While the Database Window is gone in 2007, it's replaced by the Navigation Pane.
00:42We looked at the Navigation Pane in a previous lesson, and you can see I have
00:46got it over here on the left hand side.
00:47It's just not opened right now.
00:50If I click the Shutter bar at the top, I can open and close my Navigation Pane.
00:56Well, the Navigation Pane actually works with this new user interface model that
01:00was adopted by Access 2007.
01:02It's called the Single Document Interface Model, and all that does is it
01:06places any open objects whether it's forms or reports, queries, and so on,
01:11into a single window and it will mark each object with a tab right here across
01:16the top of the screen.
01:17So right now, the Switchboard is open.
01:19If I go to my Orders Table and click on it, on my Orders Form, you can see
01:23there is a tab for that.
01:24If I go to Customers, there is a tab for that.
01:28So I can switch back and forth through my various forms just by clicking their
01:32tab, which is maybe a little bit easier than using a Switchboard.
01:36To close them up, I right-click and choose Close.
01:42So with the switchboard, we are actually enforcing a little bit more control.
01:45We can close up the Navigation Pane and just move around our different forms
01:50using these buttons and using Go Back.
01:52Now the tab still show up across the very top of the screen.
01:56So you will have to decide if a Switchboard is useful for you or if the
02:00Navigation Pane will give you everything you need.
02:03So let's recreate this Switchboard in another database.
02:07I have been using this SwitchboardSample database from the lesson_07 folder
02:10of the exercise_files.
02:12You've got access to it too but we are going to open another one.
02:15We will go up to the Office button and click Open.
02:19Next, you will need to navigate to your exercise_files to lesson_07 folder, and
02:24in there, you'll find Acme2007g.
02:27Give that one a click and click Open.
02:29We'll often see this security warning because with Access, there is VBA macros
02:35involved, and people use VBA macros to write viruses.
02:39So we need to enable that content by clicking the Options button, clicking the
02:44Enable this content radio button and clicking OK before we move on.
02:48All right, so in this particular database, we have got tables for customers,
02:54orders, and products, as well as forms for entering data into those tables.
02:59We have seen this before.
03:00If we click Customers, this should look familiar.
03:02Notice down below, I have got six customers in my database.
03:06I made customer or record 1 of 6 right now.
03:10That's going to be important as we create our Switchboard in a moment.
03:13I am just going to close this up.
03:15I am going to right-click, choose Close from the tab at the top, and now to
03:20create a Switchboard, the easiest way is to go up to your Database Tools up
03:23here on the Ribbon.
03:25Next, on the far right under Database Tools, you will see something called the
03:29Switchboard Manager.
03:30We will give that a click.
03:31We will see this message pop up, saying that the Switchboard Manager wasn't able
03:35to find a valid switchboard in the database.
03:38Of course, now we haven't created one yet.
03:40Well, would you like to create one?
03:42And the answer is yes.
03:44Now since we do that, the Switchboard Manager dialog box shows up.
03:48There is one default switchboard called Main switchboard, and that's the first
03:52open to be created and it now shows up here on my Navigation Pane.
03:57Well, if I go over here to Edit, my new switchboard I can rename it, which I am going to do.
04:03I am going to call it Main Menu instead of switchboard.
04:07Now I just need to add the items down below that will show up on my switchboard.
04:11So I'll click the New button and I can enter Text, the Command, and the
04:17Switchboard or Form in this case that's going to be used.
04:20The text is going to read like this, Add New Customers, Command itself is not
04:28going to go to the Switchboard.
04:29It's actually going to open a Form but I have got two modes, Edit which is the
04:34default when we open up a form from the Navigation Pane, but we have also got
04:38Open Form in Add mode.
04:40Now you can see this changes to Switchboard, so the form that I want to open in
04:44Add mode is the Customers form and I click OK.
04:48So I have got my first item.
04:50We just need two more.
04:51So I will click New again.
04:53This one will be for adding new products.
04:56I am going to open a form in Add mode and the form is the Products form.
05:03One to go, so I will click New one more time, Enter New Orders.
05:09This is also going to open up a Form and the form is called Orders.
05:15There we go we have got them.
05:17When we click Close, we are taken back to the first page of the
05:21Switchboard Manager.
05:22This is now called Main Menu.
05:24When we click Close, we have created our first Switchboard.
05:29Now it doesn't show up here yet but it does show up on our Navigation Pane.
05:32So when I click the Switchboard Form not the Table, the Table is just going to
05:37contain all of the commands that we have selected.
05:39The Form itself when I click on it shows up in its default format, we didn't
05:44have a lot of opportunity to alter the format but this is the default that we
05:49end up with its Main Menu and there is our three buttons.
05:52Let's see if it works.
05:53I will go to Add New Customers, look at that.
05:56I have got a blank record, Record 1 of 1 according to the bottom here.
06:00So I am ready to add a new customer.
06:03I don't see the existing ones, but I can add new ones.
06:06What's missing is Automation over here to take me back to the Switchboard.
06:11So for now, I am gust going to right-click on Customers and choose Close to go
06:16back to the switchboard.
06:18So we have got a couple of tasks ahead of us.
06:20We need to build some automation into the Customers Form, and then we might want
06:24to alter this format a little bit.
06:25It doesn't look so hot, does it?
06:27So let's start with our Switchboard here.
06:29We can go to Design View like with any other Form by clicking the View
06:32button, choose Design View.
06:34I am going to close up the Field List.
06:37If yours is open, you can close it too.
06:39We don't need it but we are going to change some of the formatting.
06:43If you recall from earlier lessons when we worked on Forms, we can access
06:48something called Auto Format by clicking the Arrange tab up here and there is
06:52the Auto Format button on the left.
06:54So when I click that drop down, you can see I have got a whole bunch of choices
06:58as I hover over them.
06:59You can see I get the name of that particular style.
07:02I am going to go down to this Windows Vista one, click on it, and already you
07:06can see there is a nice change, may not be perfect but we'll only know once we
07:11change back to our Form View.
07:13So let's go back to the Home tab and change back to Form View.
07:18It's better but not perfect.
07:19I would like to move these down a little bit and I would like to fix up the
07:22shadowing that's going on.
07:24So back we go to the Design View and I'm going to click in here and move my text
07:32up and over a little bit, the shadow text in behind, I am going to click on it
07:37and I am going to change its color.
07:39I am going to change the Font Color to dark blue.
07:41I am going to move it up slightly under and over from my original title.
07:47Notice here in Design View, we see the title of the actual database we are
07:51using, but the title we gave this Switchboard shows up when we go back to Form View.
07:57The other thing I want to do before we switch back is to create a little more
08:00space in the Form Header.
08:01So I am going to come up here when I see the double arrow, I am just going to drag downwards.
08:05That should do it.
08:06When I switch to Form View now, look at that.
08:09That looks much better.
08:10So let's save our changes by clicking the Save button.
08:14All right, so we do have some automation that needs to go into our Customers Form.
08:18So if I click Add New Customers, it takes me to the Customers Form in Form View.
08:23I am going to change to Design View now, and I have got some room over here for
08:30a Go Back button, a Print button, whatever.
08:33So let's just create one first, and then I will show you shortcut in a second.
08:37I'm going to click this button, come down here, click-and-drag right away the
08:41Command Button Wizard dialog shows up because this is selected over here under
08:46the Control section.
08:47So my wizard is enabled.
08:49This is going to do a form operation, so I am going to click over here in Form
08:53Operations and I wanted to close the form.
08:55So I'll click Close Form and then Next.
08:58It's going to give me the default picture, which is the Exit Doorway symbol.
09:02Let me click Next, and I am going to name this button just for my own purposes
09:07in Design View when I look at the objects, I will know this is the Close Button,
09:13and I will click Finish.
09:14All right let's try it out.
09:16We'll go back to Form View.
09:18Before we do, we should save our changes.
09:20In Form View, we now have a button we didn't add a text label underneath, but if
09:26we click it, it works.
09:28All right if I go to Add New Products, I want to show you that I have already
09:32added these buttons.
09:33Here is the Go Back button.
09:34I also put a little text box underneath that says Go Back.
09:37I did the same for Print.
09:39It would be nice to just borrow these from this particular form and add them
09:43to our Customers Form.
09:44So I am going to switch to Design View here in the Products Form.
09:49I'm going to highlight these, just by clicking and dragging over them, Ctrl+C as
09:55in copy on the keyboard.
09:57We'll copy what's selected.
09:58So now I can right-click on Products and choose Close.
10:03I can go to my Customers Form either by Add New Customers or clicking
10:07Customers over here.
10:09Switch to Design View.
10:12Before I paste in the new stuff, let's get rid of this one that we just added.
10:16I'll click on it once, hit Delete, Ctrl+V as in Victor on the keyboard.
10:21We'll paste what we copied a moment ago.
10:24I am going to click-and-drag those over here, and now it's going to look
10:27consistent with my other form.
10:28I am going to save those changes.
10:31I am going to close this Customers Form by right-clicking on the tab, choose Close.
10:36I am going to minimize this Navigation Pane and let's see.
10:41If our Add New Customers button works.
10:44Yeah, it takes us to a new record in our Customers Form.
10:47There is my button.
10:48Clicking Go Back closes the form and brings me back to my switchboard.
10:53So as you can see, it's still possible to create switchboards in Microsoft
10:58Access 2007 but it may not be as important to do so, now that you have got the
11:05Navigation Pane and a quick way to navigate through the various objects in your
11:09database either through the tabs that appear when an object is opened, or from
11:13the Navigation Pane itself down the left hand side.
11:17The option is yours.
Collapse this transcript
8. Working with Reports
Using the Report wizard
00:00Well, I guess it's time to ask the big question and that is, why?
00:04Why do we create databases?
00:06Why do we input tons of data into tables in a database?
00:10Well, usually it's to stay organized, a database is an organized collection of
00:15information and by entering data into our database we can stay organized.
00:19But usually what happens down the road is we want to extract some of that
00:23information and display it in a meaningful format that's where reports come
00:28in and there are number of different ways to create reports in Microsoft Access 2007.
00:31We are going to look at a few different ways to do that in this chapter.
00:36We are also going to look at ways to modify the design and add some cool
00:41features like calculations and so on to our reports.
00:45If you look up at the title bar at the top, I have opened up a database
00:48called AcmeReportA.
00:50You will find that in the lesson_08 folder of your exercise_files if you have got them.
00:54Go ahead and open that one up and you will notice on the left-hand side in the
00:58Navigation Pane, I have got Customers, Orders and Products, Tables and Forms for each of them.
01:04Now I can base a report on a table or a query, I currently don't have any query
01:09showing up here, so keep that in mind as we create our first report, which is
01:14going to be based on a typical scenario where we have customers and want to get
01:18a nice list of our customers in alphabetical order with their phone numbers.
01:22Yes, we are going to create a phone list.
01:24So the keyword there is create.
01:26We go up to the Create tab on the Ribbon and there is a Report section over here.
01:31You will see there is different ways to create a report.
01:33Here we can do it from scratch and this is just creating a basic report based
01:38on a table or a query.
01:39We can start from scratch for real here with a blank one.
01:42We can use the Report Wizard to give us a head start.
01:46That's what we are going to do in a second.
01:47We can even create Labels and we will do that later on as well.
01:51The Report Design button is what we are going to use to back into an existing
01:55report and modify the design.
01:58So let's start with the Report Wizard, we will give it a click and the Report
02:01Wizard dialog box starts up. Now the Customers:
02:05Table is currently highlighted over here in the Navigation Pane and that's why
02:08it shows up here under Tables/Queries.
02:11But if I needed to choose from a different table I click the drop-down, choose
02:15whatever table or query that I might have in this database to base my report on.
02:20I am going to select Customers.
02:22That displays the customer fields down below.
02:26So let's think about this.
02:26We want an alphabetical phone list.
02:28It's probably going to be by Last Name, so let's start with the Last Name field. Click on it.
02:33The double arrow would add all of our fields, we don't want all of our fields
02:36just a few so we will use the single arrow button.
02:39There is the Last Name, let's add the First Name and the phone number, we click
02:46Phone and the single arrow moves it over.
02:49So we have selected our fields, now let's move on to the next step in the Wizard.
02:53Clicking Next takes us to the next question and that is, do we want to do any grouping?
02:58In other words, if we've got a number of customers with the same last name, do
03:02we want them all grouped together and then maybe sorted by their first name?
03:06Well we can do that, let's click on Last Name, if it's not selected, and click
03:09the single arrow to move it over and you can see what happens here in my
03:12Display Pane, I've got Last Name here and then the first name and the phone
03:16number which show up underneath.
03:18All right, if I wanted to, I could group on any of the fields that show up here.
03:22Grouping Options is also available down at the bottom, when I click on that
03:27you can see I am asked for what grouping intervals do I want for the
03:30group-level fields.
03:32Right now Last Name is selected and the Grouping intervals are Normal.
03:35If I wanted to do it by the first 2 Initial Letters I can do that and click OK.
03:43So at least I am going to see the last name here next to the first name and it's
03:46going to be grouped by the first two letters in the last name. Let's click Next.
03:54Now we get to choose what sort order we are going to use for the detail record.
03:58So we already know that we are grouping by last name, when I click this
04:02drop-down, the first two initials are going to be used for the grouping from the
04:06last name, inside of that we want to sort by Last Name.
04:09We will go ascending order.
04:11And then for all of those with the same last name, maybe we should sort by the First Name.
04:16So we will do that, and that's all we need for this particular screen.
04:20Let's move on to the next one.
04:22Clicking Next takes us to a question where we are asked, How would we like
04:26to layout our report?
04:28And right now Stepped is selected you can see it over here.
04:31As I click on these options for Layout, I see a quick display on the left of
04:36what it might look like.
04:37I can go Portrait or Landscape, I am going to stay with Portrait and I am going
04:43to stay with Stepped.
04:44Notice down below this is checked as well, the fields will automatically be
04:48adjusted, so that all of the contents of the field and those fields will fit on the page.
04:54I will click Next and now I get to choose a style.
04:58For me, Flow is selected right now.
05:01You may have something different selected.
05:02It depends if you have created any reports in the past, but clicking any of
05:07these will give you a quick preview of what that might look like.
05:10I am going to go with Metro and I am going to click Next.
05:13All right, what do we want to call this report?
05:17Customers is the default because it's based on the customers table, I am going
05:20to leave it at Customers, but I am going to add Customers Phone List to the end
05:28and you can see now when I hit Finish, I am going to be previewing the report if
05:32I want to go straight to the Reports Design, I could select this radio button.
05:36But I want to see what it looks like, so I am going to leave that selected and click Finish.
05:41So there is my phone list.
05:43You can see the first two initials from the last name.
05:45Here is a bunch of last names that are the same, they are sorted in ascending
05:50order by first name and there is the phone numbers.
05:53So a nice clean list of my customers and their phone numbers. So that was easy.
06:00How do we go back now and modify the design of a report?
06:04That's what we are going to look at in the next lesson.
Collapse this transcript
Modifying reports in Design view
00:00In the previous lesson, we created our very first Report in Microsoft Access
00:052007 using the Report Wizard.
00:07So a number of screens popped up, we made our selections and based on
00:10those selections we represented with the following Report, which is our
00:14Customers Phone List.
00:15Now the Customers Phone List is automatically displayed in Print Preview because
00:21of the very last option we selected in the Wizard, and that was to show us the
00:25very first ten records of our Report in a preview.
00:29This way we can see what it looks like, we can decide if all of the
00:32selections we made were the right selections and if not we can to back and modify the design.
00:38That's what we are going to do in this lesson.
00:40So I know I am in a Print Preview because I see the Close Print Preview button up here.
00:45Now, if you are jumping to this lesson you can go ahead into your Lesson 8
00:49folder of your Exercise_ Files and open up AcmeReportB.
00:52You will find it there.
00:54You will need to click on the Customers Phone list, and when you do that you
00:58will actually be brought into the Design View.
01:01So if I double click this, for example, and close my Print Preview and you come
01:07into your Design View like this.
01:08If you want to get to the Print Preview at any time, you can come up here and
01:12click this little icon, which will preview the first ten records, give that a
01:16click and you will be all caught up.
01:17All right, I want to just show you from Print Preview that there are a number of
01:21things you can do to modify your Report right from here.
01:25You don't have to go into Design View right away.
01:27For example, up here under Page Layout, we have got options for changing the
01:31size of our paper, our Page Size, the Orientation, right now Portrait is
01:37selected but I can choose Landscape.
01:38I can change Margins, Columns, Print Data Only.
01:42Now I have got a Page Setup button that will allows me to get into the details
01:45of all of these things.
01:47Right now though if I move around my Report with my mouse pointer, you can see
01:50that it's actually a magnifying glass.
01:53It has a minus sign in it right now so that means if I click once I am going to zoom out.
01:57If I want to zoom in to a particular area I can move to that area and click and
02:02I am zoomed into that portion of my Report.
02:06Zooming out, zooming in.
02:10I am going to zoom right into the middle section here.
02:12All right, so I may want to change a few things, if I go to Landscape.
02:16From this mode I really don't see a change.
02:18So I am going to zoom out to see what that looks like, lots of empty space over
02:22here, I will flip back to Portrait.
02:24How about the Margins?
02:25From the drop-down I have got three choices, Normal, Wide, and Narrow.
02:29If I click on Narrow, you can see that it takes it right up to the top.
02:33I don't need to do that.
02:34I am going to back to Wide and see what that looks like.
02:38No, little squished in.
02:40I am going to go back to Normal.
02:41Now if I wanted to put in my actual own Margin figures or values then I could go
02:47into the Page Setup right over here.
02:49When I click Page Setup, I am going to see tabs across the top including Print
02:53Options, there is a Page tab, and the Margins that are being used currently show
02:58up here, those values.
02:59I can change those if I wanted to.
03:01Under the Page tab, I have got the Orientation and the Paper Size, also
03:05the Default Printer.
03:07Under the Columns tab I can choose the Number of Columns I want to do, Column Size.
03:12I am going to hit Cancel to leave it as is.
03:17Now when I am viewing, obviously I know now that I can zoom in and out but what
03:21if I want to take it to a specific zoom level.
03:23There is a Zoom section when I click the drop-down.
03:26I want to go to 50%.
03:27You can see what that looks like.
03:29Let's go back to 100%.
03:33And if I want to see the whole thing on one page, Fit to Window, there we go, perfect.
03:39If I have got tons and tons of records that show up on many, many pages in this
03:43Report, I can switch the number of pages I am looking at, One Page, Two Pages,
03:48and you can see I don't have enough records to flow it on to the second page.
03:52If wanted to see more pages than two on a single screen I could do that 4, 8, and 12.
03:57But I am going to go back to One Page.
04:00Now, when I am done viewing this in Print Preview, I can click the Close Print
04:04Preview button and go back to the Design mode where I can actually make changes
04:10to the design of this particular Report.
04:13So there are several sections to my Report.
04:15There is a Report Header.
04:16This information will appear at the top of the first page only in my Report.
04:21The Page Header, this information, Last Name by 2 Initials.
04:24These little headings will show up at the top of every page.
04:28Then I have got the Last Name Header, you can see that, saying that I was
04:33going to be searching for the first two characters in the last name and grouping that way.
04:38And that was based on the selection we made during the Report Wizard function.
04:43And then down below is the actual Details of the Report here is where I see the
04:46actual Last Name, First Name and Phone Number right in here.
04:51So if I needed to add some fields, I can go to my Field List here.
04:55The Field List shows up whenever this button is selected, Add Existing Fields.
05:00If I click this button I close it up, if I click this button it toggles back on.
05:05So if I thought it might be good to have the e-mails in there as well, while I
05:09try to find a space for it and add the e- mail by simply clicking and dragging it
05:14from here on to my Report.
05:17That's kind of stuff I would want to drag into the Detail section.
05:21I do have some things showing up in the Page Footer by default, this =Now ()
05:26code represents the current date.
05:29If I scroll over to the right, I can see some code for putting in the
05:33actual page that I am on.
05:36Page one of one, for example.
05:38All right, other things I can do to the design.
05:42You will notice I have got a Design tab up here and I have also got Arrange, and
05:46I have got Page Setup.
05:48So there is my Page Setup options again which I can alter right here from Design
05:52View or I can go up to the Arrange, choose a different format.
05:55I kind of like this Windows Vista one here, so I am going to give it a click, I
06:00am going to see what looks like.
06:03Remember, we can go up to the Design tab and choose Print Preview.
06:07That looks kind of cool.
06:10I am going to zoom in, interesting.
06:11It looks like anywhere where I have got more than a couple of records or more
06:17than one that I am going to see alternating bands.
06:21So it makes it easier to read in this Report, very cool.
06:26So making changes to an existing Report, not a big deal.
06:30You can preview your changes anytime, when you are done close the Print Preview.
06:34And from Design View, you have got tons and tons of options at your disposal.
06:39One last thing we are going to do is put in our logo.
06:42So I am going to go up here from the Design tab. Select Logo.
06:47I am going and get my Logo from my Exercise_Files.
06:51So you can too in your Exercise_Files.
06:56Let's go back to the Lesson7 folder and grab that Logo and click OK.
07:02You can see that it puts right on top of my text, I am going to click on the
07:07text, I am going to move it off to the right and I am going to preview that.
07:16Looks great and I am happy with my Report.
07:18I close the Print Preview.
07:21I save my changes to the customers Report.
07:24And the next time I open it up, I will see it the way I want to see it.
Collapse this transcript
Adding custom calculated fields to a report
00:00So we know we can create reports using the Report Wizard.
00:03Go back and modify the design if we want to, but there is another way to create
00:07reports, a couple of different ways actually, and depending on the table you
00:10relate the report to, if there is numeric data in that table, we could see some
00:15calculations down for use as well.
00:17I will show you how to do that a couple of different ways.
00:19If you are skipping to this lesson, go to your lesson_08 folder of your
00:22exercise_files, and open up AcmeReportC.
00:26Once you got that open we are going to go into the Orders Table, this is the one
00:30we are going to base the report on, so click the Orders Table.
00:34You can see we have got some data in here, and we have also got a currency
00:39amount showing up here.
00:40Wouldn't it be nice if we had a grand total of all our totals?
00:43That's what we are going to do next.
00:44So we are going to create a report, I am going to show you a fast and easy way to do this.
00:49If we click the Report button right here in the Report section on the ribbon, we
00:53will create a quick-and-dirty report based on the selected table, in our case,
00:57the Orders table, watch this. Done.
00:59So we have got all of the fields taken from the Orders table and displayed here
01:05in columns including the total and look what happen automatically.
01:09This was added up for us.
01:11That we got a sum of all of our orders. That's awesome.
01:15So, how do we do that ourselves?
01:16How did this happen?
01:17Well, it's easiest to show you in Design View.
01:21So let's go up to our view drop-down, we will go Design View and you will see
01:26what's happening here.
01:27We have got a Report Header and we can change the logo and the title etcetera.
01:32There is our Page Header.
01:33We have got labels for each of the actual fields down below in the Detail section.
01:38There is a Page Footer automatically that is going to show us the current page
01:41number at the bottom of every page and then at the end of the very last figure
01:46in the Total column, we will see a sum of the total field.
01:51So the word total here represents the field.
01:53It's in square brackets, and in round brackets, we have got next to the word sum
01:57and the equal sign our actual calculation.
02:00So if you knew that, you could type it in here, but there is even better ways to do it.
02:05So let's create another one actually from scratch this time.
02:08So we are going to close the Orders report without saving out changes, and
02:14instead, we are going to go up to the Create Tab and create a report that starts
02:20off blank right from scratch.
02:22Blank report gives us a blank page and now we have to actually go and select
02:27what appears in this report.
02:29So the first thing I am thinking, I would like to see is the customer name.
02:32So I am going to double-click First Name here after selecting Customers to
02:36expand that list of fields.
02:38Double-clicking Customer ID is going to pop that in there.
02:41Do I really need Customer ID?
02:43No, if I click up here and hit Delete on my keyboard, I can remove anything that
02:48shows up on my form.
02:50I do want their first name, double-click, and last name, double click, I
02:55don't need any other Customer information so I am going click the minus sign
02:58now to collapse that.
03:00I do want some order information.
03:03So down here, I would like to see the Product ID, Quantity, and Total.
03:08I am going to double-click Product ID because it's related to the products down below.
03:12I am going to need that.
03:15And then also from Orders I want to see the Quantity and the Total.
03:20It will be nice to see what that product is next to the Product ID.
03:26So I am going to click the plus sign next to Products and choose the product
03:30name, double-clicking it.
03:32And it gets popped in over here on the right-hand side, and I'd rather have that
03:37over here next to my Product ID.
03:40So when I click down here, I get that all selected, I am going to slide it over.
03:45You can see as I move there is a bar in between.
03:49Soon as I hit Product ID, I am going to release and it reorders things for me.
03:53I am not in Design View here.
03:55I am in Layout View.
03:56When I come here and click the drop down, I am going to go to Design view now to
04:02make some additional changes, because right now, I am not seeing a calculation.
04:05You can see I have only got a Page Header and a detail section, the Page Footer
04:09is blank, and there is no actual Report Header either.
04:14So let's go back to this View drop down and choose Report View to see the end
04:18result so far, very plain just information.
04:22You can see I do have numbers showing up here but no total.
04:26So back we go to Design View and I am going to scroll over down at the bottom of
04:32my screen here, so I can see the Total field and I am going to click on it.
04:35As soon as I do that, the Grouping & Total section now is going to allow me to
04:40select from the Totals drop down, so I click that, and you can see my choices:
04:45sum, average, I can count records and values, minimum, maximum etc. I want to sum.
04:52Watch what happens when I click sum.
04:54It adds the Page Footer and the report footer sections for me and there is that
05:00calculation, excellent.
05:03Now before we go back and look at a very plain looking report, let's go
05:06and change the style.
05:07I am going to go up to the Arrange tab and use Auto Format, and I am going to go
05:12back to that Vista style.
05:14There we go, in the Report Header it might be nice if we had our logo and maybe a title.
05:20So, I am going to go back up to the Design tab up here, I am going to click Logo.
05:25Now I am going to navigate to my lesson_07 folder of exercise_files.
05:30That's where we had a logo, click on the Logo and click OK.
05:35It inserts it for me and I would also like to have a title in here.
05:40This little icon up here represents title. Click that.
05:44You can see Report1 shows up.
05:45I can double-click that to highlight it.
05:47With it highlighted, I am going to type in my own title, which is going to be
05:55Order Totals, expands to accept my text and I click outside to deselect, and it
06:01looks like that coloring is going to work with our background. So back in we go.
06:05I am going to click-and-drag to highlight everything.
06:08We are going to change that to a different font color.
06:11Let's choose white.
06:14That looks better, and maybe if we wanted to put in some page
06:19numbering, etcetera.
06:20We can create a little space here by clicking-and-dragging and in the Page
06:24Footer section, you might want to put the page number.
06:28So Page N or Page N of M, I am going to use this one.
06:33We want it at the bottom in the footer. Centered?
06:36No, let's put it on the right, and we will click OK.
06:40So if I scroll over you will see that that's been entered for me, and all we
06:46need is that Sum Total in there to show up nicely for us.
06:49Let's check our view. Look at that.
06:53Very nice.
06:54So this looks way better than it did before, but we started right from scratch
06:58with a blank report, now you know how to get the fields you need in there, from
07:03different tables, to get the values you want to show, and to total them up.
Collapse this transcript
Formatting reports
00:00Whenever you create Reports in Microsoft Access 2007, regardless of the method
00:05you can always come back later and make adjustments to Layout and Design.
00:10That's what we are going to do in this lesson.
00:11And we are going to use the Order Totals report that we have created in
00:15the previous lesson.
00:16So if you have been following along you should be in the right spot here, this
00:19is the report we are going to modify.
00:21If you are jumping to this lesson, take a look at my Title Bar.
00:24You can go to the Lesson8 folder of your Exercise_Files and find AcmeReportD.
00:29Open that one up if you got it and you will be all caught up.
00:32As I look at the end results of this report where we used some auto
00:36formatting, for example, I got some empty space here I may not really need to
00:41see in this report.
00:42The Product ID, which is being used to link tables in this report, doesn't
00:47necessarily need to be viewed.
00:49So I might want to make that invisible.
00:51If you look over here under Customers, Orders, and Products, I see the Order
00:56Totals report in each one of these table sections. Why is that?
01:00Because I borrowed fields from each of those tables to create this Report.
01:05So, I need the Product ID which links the two tables, Product and Orders but I
01:10don't necessarily need to see the results.
01:12So we can make that invisible. That's one thing.
01:14And maybe change up the look and feel of this Report a little bit as well.
01:18So with Order Totals selected, we are going to change the layout first, let's go
01:22up to our View drop-down and select Layout View.
01:24Now, when I click this, right away I have changed views obviously but the
01:29Property Sheet has shown up here for me.
01:31Now, this should be the default but depending on what you did the last, if you
01:35worked with Fields, for example you may not see the Property sheet.
01:38You may see the Field List or you may not see anything at all.
01:41To get the Property Sheet open, you can come up here under Report Layout Tools.
01:46Currently Format is selected for me.
01:48There is also an Arrange tab and you will see the Property Sheet button right here.
01:52Alt+Enter on the keyboard is a shortcut for displaying the Property Sheet or
01:58hiding it if it's open.
02:00So with the Property Sheet showing, check out the different tabs depending on
02:04what's selected, and let's just click on our title, Order Totals.
02:08It shows up here in the drop-down.
02:10Now I can switch to any of those objects in my Report by selecting them from
02:14here, I am going to leave to at my Auto_Title().
02:17This is created using the Auto Format Tool and that's why it is called what it is.
02:21Down below I have got tabs for formatting my title.
02:24I have got a Data Tab.
02:26You can see I have only got Smart Tags.
02:28It's not being used but we can attach Smart Tags to a title.
02:31We have got an Event tab so we can set up events to happen when we click on our
02:36title or double-click or mouse down, up, or move over it with our mouse.
02:41There is an Other tab as well.
02:44We can put in Tips in there, Shortcuts, etcetera.
02:47And then if we want to see all of those tabs all thrown together and all of
02:50their options, we can choose the All tab, check out the scrollbar, there is
02:54great big long list of properties we can play around with.
02:57So we can change Fonts, Alignments, Gridlines, Margins, etcetera.
03:02I am going to scroll all the way up to the top and move back to Format.
03:06So I am okay with the actual format of my title, but I am not okay with what's
03:11happening down here.
03:12I am going to click on Product ID, I am going to go over to the right-hand
03:16side and when I see the double arrow, I am going to click and drag this in as far as it can go.
03:21So I have closed up that gap, I don't have that empty space showing up any more
03:26but I do see some remnants here.
03:28I have gone as small as I can go.
03:30It might be best if I made this invisible in my actual report.
03:34So with it still selected, notice here on the Format tab the second item down
03:39for this label is Visible.
03:42It's currently set to Yes.
03:43I am going to click next to Yes and change it to No by clicking the
03:46drop-down and selecting No.
03:48Now that's just the label, the data down below, when I click on it with it
03:53selected I can also make it invisible by clicking next to Yes here in the
03:57Visible row and from the drop-down selecting No.
04:00All right, let's see what that looks like so far.
04:04If we go back up to our Home tab here on the ribbon, and click the default
04:08button when we are in Layout View, which is the Report View button, you can
04:12see the end result.
04:13So we have closed up this gap, everything has moved over for us.
04:17So that makes this stuff out of line a little bit.
04:19So, let's go back now to the Design View.
04:23This time in Design View we can work with things like what shows up here in the Page Footer.
04:29In Design View, you can see my Property Sheet is still open.
04:32I have got my Sum down here, I am going to scroll over and this is what's out
04:37of whack over here.
04:38It's the code for my page number.
04:40So I am going to click on that.
04:41As soon as I move to the border here and I see the four pointed arrow I can
04:46click and drag to move this in.
04:48I am going to move it in all the way over here.
04:53So we can what that looks like by going up to our Report View button.
04:57It's kind of centered, now it's a long field that's got a lot of empty space.
05:02So, let's go back to Design View, and with it still selected we can make changes
05:10to it such as the alignment or even the width.
05:13Right now, it's very wide and the page number showing up over here almost looks
05:17centered in our Report.
05:19But you can see the right side of my actual Control Box is lined up with the
05:25right hand side of my Total, my Sum down here, and my labels.
05:32So let's just see if we can change the alignment of the contents of this Control Box.
05:36And down below you can see Text Align here in my Format tab in the Property
05:41Sheet is set to General.
05:42I am going to click next to General, click the drop-down and I am going
05:45to choose right align.
05:46So everything is lined up on the right.
05:49Now, when I go up to my Report View, check it out.
05:52That's looking better.
05:53So over here, underneath my grand total, perfect.
05:57Let's go back now to the drop-down, go to Design View and up at the top here
06:04where we got our Design tab, I would like to go over to the Arrange tab and
06:08check out some other AutoFormat options.
06:11So, I am going to click this drop- down and maybe you want to change the
06:14whole look entirely.
06:15Let's try this one called Metro, for example.
06:17Now as soon as we do that we are going to see a change in the AutoFormat.
06:23Okay, color combinations are slightly different.
06:26Let's go back again, try something different, here is Northwind, for example.
06:32Now we are only making changes to what's selected.
06:34Did you notice nothing is happening up here in my Report Header or my Page
06:38Header, because I have got something selected?
06:41So, if I come down here and click, so none of my fields are selected.
06:45Come to the Auto Format and now we will try Metro, for example.
06:50The whole thing is affected.
06:52So, it's very important to pay attention to what's showing up here in the drop-down.
06:56Any changes we make will only be made to whatever is selected.
06:59So, if it happens to be one of those labels like Label1, whatever.
07:04We wanted to say Report.
07:06We can select Report from here.
07:07It's an alphabetical list.
07:10Or if we wanted to just click off of any selected items to select the entire Report.
07:16So, let's see what that looks like, go up to our Home tab on the ribbon,
07:20switch to the Report View.
07:21That's much different.
07:23And in fact, it doesn't really work with that Product ID that used to be in
07:27here, and you can see we have got a space.
07:29So we would have further changes to make in our Design View. We come in here.
07:34Product ID is back. I click on it.
07:37It's still not visible but it is taking up space.
07:41So I would have to come over to the right-hand side and squeeze it right in.
07:45Everything else closes up. Check it out.
07:48That's much better even though there is still a little bit of space there.
07:52That's some thing I could live with.
07:53I like the look of this Report now, separating our customer information slightly
07:58from the rest of the information.
08:00And of course any time we make changes like this to Layout or Design, it's
08:04important that we come up and click our Save button to save our changes.
08:09So keep in mind although we are using AutoFormatting and we are using Report
08:13Wizards and all kinds of automation Tools to create our Reports, we can always
08:18come back later and modify both Layout and Design by changing our Views to
08:23Layout or to Design View and making our change from the Property Sheets or we
08:28can also go to our Field List.
08:30Let's say we are missing a field on this report.
08:33Let's go back to our Design View, and from here we decide we need to bring in a new field.
08:40We can get our fields by clicking the Add Existing Fields button showing up
08:45here on the right, and if I wanted, for example, Phone number showing up on this Report.
08:51I just simply drag this field in to my Report.
08:54And I would want to have some space for that, if I scroll over, you can see I
08:58do have room for that.
09:00Click and drag it down here.
09:02There is my Phone number.
09:05It has a label attached to it as well.
09:10That's this part over here.
09:12Clicking the Control Box allows me to move it closer if I wanted to, or simply
09:17delete that label if I don't need it.
09:18I just want the number to show up.
09:22If we look at this Report, you can see Phone number is down the right-hand side.
09:27If that doesn't make sense, how do we take out fields?
09:29Well, now that you know how to bring them in, to take them out is even easier.
09:33We just go in to the Report itself, find the field.
09:37If it's not already selected, click it.
09:39Hit Delete on the keyboard.
09:41Check out the end results. That looks good.
09:45And we are done.
Collapse this transcript
Summarizing report information
00:00If you have been following along in this chapter, you know how useful reports
00:03can be for displaying information that exists across one or more tables.
00:09The beauty of a report is that we can take information from a couple of
00:12different tables and put it altogether in one place.
00:15Look at my Order Totals report here.
00:17It has grown since the last lesson because I have added some new orders in here
00:21to this particular database.
00:23You will see that it's called AcmeReportE.
00:26So if you have the exercise files and you are following along, you'll want to
00:28open up this database to be all caught up with me.
00:32Now, down below I have got information that's coming from multiple tables.
00:36I have got information that's coming from the Customers:
00:38Table, customer information.
00:40I have got info coming from the Products:
00:42Table as well as the Orders: Table.
00:44It's all gathered together here in one nice report.
00:47What I haven't touched on yet really is summarizing data.
00:51Wouldn't it be nice to get a list of all our customers by state for example and
00:55get a running total of how many customers we have in each state, or how about
01:00their orders, even more important maybe you want to total up all the orders by
01:03state and total up how many orders have come in from that state.
01:07Well, we can do that by summarizing data in a report.
01:11We are going to do that in this lesson now.
01:13So, the first thing we need to do is go up to the Create tab and to get a head
01:17start, we are going to create a report using the Report Wizard.
01:21That will give us a nice head start and then we can go back and fine tune.
01:23So I am going to click the Report Wizard, I am going to make sure Customers
01:28is the table that's selected right here, if it is not, from the drop-down
01:32just select Customers.
01:34I want their Last Name to show up first, I am going to click on it and then the
01:37single arrow moves just that one field over instead of all of them.
01:41Then I want the First Name.
01:43And I am going to be grouping them by State so I need that State field as well. I will click Next.
01:48Here is my grouping question.
01:51Yes, I want to group them by State, so I will select State and move it over.
01:55I get a quick preview of what that's going to look like, great, Next. How about sorting?
02:02Well, I want to sort by Last Name and then those with the same last name, I want
02:06them sorted by First Name.
02:09Great, I will hit Next.
02:11How about the style or layout?
02:13Well, I am going to leave it at Stepped because as I click on Block and get a
02:18quick preview and Outline, they are not quite what I am looking for.
02:21So I am going to leave it at Stepped.
02:22But I do want the field widths to be adjusted for me so that all the fields will
02:26be able to fit on one page.
02:27I am not too worried about that quite yet.
02:29Click Next, we will choose a style now.
02:33If we go up to -- actually I like the one that was selected for me here, Technique.
02:38Go ahead and select that one as well and then we will click Next and we
02:42will give it a new name.
02:43It's not going to be called Customers.
02:45It's actually going to be called Orders by State because that's what's going to be summarized.
02:51Let's preview the report, we know it's not finished yet, but we will preview it
02:54to see what that looks like so far.
02:56So let me hit Finish.
02:57You can see that they are grouped by state. That's great.
03:01These are the actual orders, perfect and the customers themselves are not
03:08showing up with any order information at this point.
03:11I do see a lot of space though.
03:12So we are going to tighten up the actual fields that are here so far and
03:17add some new style.
03:18So to do that, we are going to close our Print Preview.
03:22That returns us to the Design View.
03:24You may or may not have a window open here on the right.
03:28It could be the Property Sheet or it could be Add Existing Fields.
03:32The one we really want is Add Existing Fields, so make sure that that one is
03:36showing up here from the Tools section on the Design tab on the ribbon.
03:42What we need to do first is add a field.
03:45We need to get the total for the number of orders that are being placed here by
03:48each of the customers in each of the various states.
03:51I am just going to click down here in the Report Footer, so nothing is selected.
03:55Get my double arrow over here and just drag to the right so I can see a little better.
03:59I can see that Last Name here and First Name are really too wide.
04:02So I am going to click on the Last Name.
04:04I want to create some room for my new field.
04:06When I see the double arrow on the right here, I can drag that across.
04:09Now, I am going to go to about two-and-a-quarter inches about.
04:14First Name comes over with it, so I am going to click on the First Name
04:17field now and do the same when I see the double arrow and I drag that over
04:21to about the 4 inch mark.
04:24That gives me some room now and I can scroll over to see there is a quite a bit
04:27of room there for me to add some fields.
04:29The field that I want to add is actually the total for the Orders table.
04:34So the Orders table shows up over here.
04:36You may have a plus sign and if so you can expand it.
04:39A minus sign means that it is expanded and we can collapse it.
04:43We need to see the fields in the Orders table so we can click-and-drag Total up
04:48here into the Detail section of our report.
04:51And you can see what just happened there.
04:53Total came over, there is where the value is going to show up and there is
04:56also a label and if I click on the label, it's selected and the actual field itself is not.
05:02Because I don't need the label, I am just going to hit Delete and I am going to
05:05move the Total field here as soon as I see the four-sided arrow, I can drag it
05:10up and over next to First Name, right there.
05:15Perfect, I can close this up a little bit because of too much space and that looks good.
05:21So I click down here to deselect.
05:23We can preview that by clicking the Report View and you can see now I am getting
05:29Quantity is showing up and because I am looking at Orders, I am seeing duplicate
05:33names here because each of the orders is showing up for that customer.
05:36That's what I want.
05:38The next thing I want is the number of orders for each of these states totaled
05:42for me and then a total for all of the orders that are being placed for that
05:46state as well as a grand total.
05:48So back we go to Design View and from here we are done adding fields, we can close this up.
05:56What we want to do is add some calculation.
05:58So for example, if I click on Total and I want to see totals by State.
06:02Look what happens when I come up here.
06:05Click on Totals and I choose Sum.
06:10Something just happened because I have got Grouping turned on by State.
06:14A State Footer appears and down here you can see I have got a sum total showing up now.
06:19That's excellent.
06:21Down below it's hard to see right now but there is a grand total in the
06:24Report Footer as well.
06:25I am going to click down here, so nothing is selected.
06:28The other thing I want to do is just get a running count of the number of
06:31orders of by State.
06:32So I am going to click on either Last Name or First Name here.
06:35It doesn't matter which one and I want to count all the last names that show up
06:39in each of these state sections.
06:41So, with Last Name selected, I am going to go up to my Totals drop-down again,
06:45I don't have as many choices because it's not a numeric field, but I can, Count Records.
06:49So I am going to click on that.
06:51You can see what happened.
06:52Now a count is going to show up in the State Footer as well and down below a
06:56grand total of all the orders showing up in the Report Footer.
07:00All right, let's go up to our Report button, or Report View button.
07:05Look at that, so they are grouped by state in alphabetical order.
07:10Within there, you can see I have got an alphabetical listing as well by Last
07:13Name and then First Name.
07:16For each of the states, I am getting a running count of the number of orders, 5
07:20of them in Pennsylvania, and then over here you can see I have got totals
07:25showing up underneath for each one of the states as well as, grand total is very
07:31hard to see down here with this particular style, but it's down here in the
07:35Report Footer section.
07:36So 8 orders for a total of 241,296.
07:38So you can see that, yes we can run reports to gather information from various
07:45tables and display it in one spot, but we can also summarize that data using a
07:50couple of calculations.
07:51Report Wizard is always a great idea for giving you a head start when
07:55creating your reports.
Collapse this transcript
Creating a mailing label report
00:00One feature I really like about Microsoft Access is a built-in reporting
00:04function specifically designed for creating labels.
00:08If you have been following in this Chapter you know that our scenario here is.
00:12We've got a number of customers placing orders from all over the United States.
00:16If we want to send something out to our customers by mail, it would be handy
00:20to create mailing labels since we have all of their information in the
00:24Customer's table already.
00:26Well, instead of creating a Report from scratch designing the label and
00:31measuring the size and trying to make it fit when it prints, while there is a
00:34built-in function specifically for creating those labels and drawing that
00:39information out of an existing table.
00:41That's what we are going to do right now.
00:42If you are jumping to this lesson and you haven't been following along, you can
00:45open up a database called AcmeReportF.
00:47It's in your Lesson 8 folder of the Exercise Files, if you've got them.
00:53And once you open that up it really doesn't matter what shows up on your screen here.
00:56We are seeing a Report that we created in the previous lesson here on my screen.
01:00But really what we want to do is click on the Customers:Table because that's
01:05where the information lies that's going to be used for our new report that will
01:09simply be a number of labels.
01:11Next, I want to make sure the Create tab is selected before we go over to the
01:16Reports section, we are not going to use the Report Wizard or the Report button,
01:20not even a Blank Report.
01:21We are actually going to use this one here, Labels designed specifically for
01:25creating our mailing labels.
01:29So, the Label Wizard begins.
01:31The first thing I like to do is take my box of labels and look at who
01:34the manufacturer is.
01:35So, I come down here and Filter by manufacturer, I am going to choose Avery.
01:40So, if that's showing up there by default that's fine, but look at the long list
01:45of manufacturers we have here.
01:47Lots to choose from.
01:49Yours is likely to be on that list.
01:51You just select it and that means that what you are going to see up here for
01:53Product numbers corresponds to the manufacturer.
01:57All right, so I have got a number of options here.
02:00I kind of like this one here, 5395, all right again, look at my box and if
02:06that's the product number I see, that's the one I want to select, because the
02:09dimensions are already set out for me here.
02:12You can see its two labels across and then there is a number of rows of label as
02:16well, depending on what you choose for the label type.
02:19Now Sheet feed is what's likely going to be selected for anyone with a laser
02:24printer or an inkjet style printer.
02:27If you are using the old Dot Matrix you might wan to choose Continuous, but most
02:31often it's going to be Sheet feed.
02:33We are going to click Next and now we get to choose our text appearance.
02:37You can see my default here an Arial font and the font size is 8.
02:42Yours may be the same or different, but we can change that.
02:46That's the important thing and there is our font list.
02:49I am going to go all the way down my list into the V's and I am going to
02:53choose this one here.
02:56Font size, I am going to bump it up to 10 and I am going to leave the
03:01Font weight at Light.
03:02The Text color though I may change, I can click right in here where it says
03:06Text color, right on the little button to bring up a color swatch and I am
03:10going to choose a dark blue.
03:12I do have a color printer, so this will work for me.
03:15All right, I don't need it to be Italics or Underline, I will click Next and
03:20now I get to choose the fields from the Customer:Table that I am going to use for my label.
03:26I want FirstName, so I am going to select that.
03:29You can see what happens.
03:31I need to leave a space after the FirstName, so I hit the Spacebar on my keyboard.
03:35LastName is already selected.
03:36I will move it over.
03:37I am going to press Enter to move down to the next line.
03:41That's where the Street goes.
03:42I am going to press Enter again, because that's where the City comes.
03:47It's already selected.
03:48Scroll down, State comes after the City, but before I put in the State, I am
03:54going to put in, right here by clicking after City a comma and a space, so I
03:59can do this formatting.
04:01Now, I am going to put in the State.
04:02I am going to leave a space after the State and that's where I am going to put
04:06in the Zip code, already selected, there we go.
04:10When I click Next, I move on to the next screen and I get to choose now how I am
04:15going to sort my Labels.
04:16And I'd like to sort them by LastName.
04:21Anyone with the same LastName, secondary sort is going to be on the
04:25FirstName and Next.
04:29Labels Customers is going to be the default name for this particular Report and
04:33I am fine with that.
04:35My options down below, when I hit Finish, we will be to see the Labels as they
04:38will look when they are printed or to modify the label design.
04:42Well, before I modify anything I should see what it's going to look like.
04:45So, I am going to hit Finish.
04:48I do get this dialog coming up that there is not enough horizontal space on the
04:52page for the number of columns and column spacing that I specified.
04:56Here I can click the Page setup on the File menu, click the Columns tab and then
05:00reduce the number of columns or the size etcetera.
05:02It's giving me some hints, if I need to go back into my Design View and make some changes.
05:07I am going to click OK.
05:08This actually looks okay.
05:10If I zoom out, you will notice that my mouse pointer is a Zoom Tool with a minus
05:14sign, which means one-click will zoom me out and there you can see what my
05:18Labels are going to look like when they print.
05:19I am going to click again to zoom in right to the middle here and scroll up and
05:26that just saved me a ton of time.
05:29So, a built-in reporting function that allows you to create mailing labels in a jiffy.
05:34Of course, we can go back now if we wanted to by closing the Print Preview into the Design.
05:39You can see what the Report design looks like.
05:41And this is all based on what we selected for the Manufacturer and the Product
05:46number for our Label.
05:48We don't really want to fiddle around with that.
05:50Everything seems to fit okay, so we are all right to go up and save this and
05:55use it anytime we need.
05:57The neat thing is that you will see that under the Customers section here, under
06:01All Tables, we have got our Labels Customers Report.
06:05As we add new customers over time, each time we run this run report, we'll get
06:10a bigger and bigger list of customers and more and more labels printing out each time.
06:15So, we don't have to come in here and update this at all.
06:17We just have to add our customers and know that the next time we need to send
06:20out something by mail, all of our customers are going to print out on their
06:24very own label.
Collapse this transcript
Printing reports
00:00If you've been following along in this chapter dealing with reporting, you know
00:04reports are great way to display your data, gather data from multiple tables,
00:08put it altogether in one place.
00:10We can summarize our data, run calculations on it, even create mailing labels in
00:15a report like we did in the previous lesson.
00:18Well, then you might be thinking the next logical step is going to be what, to
00:22print out those reports.
00:23Think about mailing labels.
00:25They're designed to be printed, aren't they?
00:27You wouldn't just view them on the screen, once you've got the report and it
00:30looks good, you send it to the printer, peel off the label, put it on the
00:33envelope and send them off.
00:34So we're going to talk about printing now.
00:36In the previous lesson, we created this report called Labels Customers.
00:40It is a mailing label, and this is what we're going to print.
00:43If you're jumping to this lesson and you haven't created this report yet, go
00:47ahead and navigate to the Lesson 8 folder of your exercise files and open up
00:51this database called AcmeReportG.
00:54Next, you'll click on Labels Customers, and you'll go up to your View button and
00:58change to Design View to be all caught up with us.
01:01Now before we just go up to our Print button up here on the Quick Access Toolbar
01:05and give it a click, that would just send our mailing labels.
01:09We have no idea, really, if it's going to look right.
01:12I like to get a print preview before I send something to the printer, especially
01:16mailing labels, which can be expensive, and if they're not lined up properly,
01:20they don't look right, then you've just wasted a sheet of labels.
01:23So to get to print preview, there are a couple of different ways we can do that.
01:27We can go to our View dropdown, and from the dropdown select Print Preview.
01:31That will show us what our report is going to look like, in this case,
01:35our mailing labels.
01:36It also shows us the Print Preview ribbon, where we've got a bunch of options.
01:41We talked about those in a previous lesson.
01:43Another way to get to print preview, I'm going to close print preview here.
01:48I'm going to go up to my Office button, down to Print and select Print
01:53Preview from there.
01:55So exact same thing, I'm in Print Preview now.
01:57I've got the Print Preview ribbon.
02:00I'm going to close it and show you one last way.
02:02And that's from the Design View that we're in, is to come over here to the Tools
02:08section on your ribbon.
02:09This little guy here is called the First 10 Records Preview.
02:13It's really the same thing, takes us to the Print Preview ribbon, where we've
02:16got all of those options for previewing our report.
02:20So once it looks good, you'll notice that my mouse pointer here in Print Preview
02:24is a magnifying glass with a Minus sign.
02:26I can zoom out to get a feel for the entire page, looks good.
02:30It's going to work.
02:31Now my mouse pointer is a magnifying glass with a Plus sign.
02:34I can zoom back in.
02:36I just want to talk about these quickly.
02:38Under Page Layout, I can change the Page Size, the orientations from Portrait to
02:43Landscape, the Margins, the Columns, all of that, even the entire Page Setup.
02:47But I want you to remember what we did in the previous lesson.
02:50We used the Labels function to create this report, selected our manufacturer,
02:54the product ID, so all of these settings are set up for us and they match what
02:59we have in our printer right now waiting to be printed.
03:01So you really don't want to go in here and fiddle around too much with these settings.
03:06Now on occasion, you might end up with an address, for example, that's just too wide.
03:10You're running out of space.
03:11You could come into the Page Setup and change the Margins.
03:15Give yourself a little more space, but you wouldn't want to change your page or
03:19your column settings, because they were all set for you during that routine
03:23where we set up our mailing labels using the built-in functionality.
03:27So I'm going to click OK.
03:29All I need to do now is actually print this.
03:32I can do that from the Office button.
03:34But I can also do it from the ribbon here.
03:36The very first button is my Print button.
03:38So I give that a click.
03:40We get the Print dialog box.
03:42You can see my default printer, that can be changed from here if I need it to.
03:47If I want to print all, that's the default as well, but if I only want to print
03:51certain pages or selected records, I could do that.
03:54Right now, I only have enough records to fit on one page, so I don't get these options.
03:59I can change the number of copies though.
04:01If I wanted more than one copy of this sheet of labels, I could pump it up.
04:05I'm going to pump it back down.
04:08But when I'm ready to print and I've got my mailing labels in the printer
04:11already, you want to make sure that you do that before clicking OK.
04:16Clicking the OK button will send it off to the printer.
04:19As it prints away, I'm still in Print Preview.
04:21I'm going to close my print preview, returns me back to my previous view, which
04:25was the Design View.
04:27I want to make sure if I made any changes to save by clicking the Save button,
04:31and I'm ready to move on.
Collapse this transcript
9. Working with Macros
Creating macros
00:00It's time now to talk about Macros in Microsoft Access 2007, and Macros in
00:05Access are a little bit different than Macros you may be used in another
00:08applications like Microsoft Word and Excel for example.
00:12In those applications, a Macro is basically a recording of keystrokes and mouse-clicks.
00:17Well, in Access, Macro is actually going to be a recording of actions whenever
00:23we run a report or send that report to the printer, for example.
00:27Those are actions that take place in our database.
00:30Well, we can create a Macro to automate some of those tasks and just make life a
00:34little bit simpler for ourselves.
00:36That's what we are going to do now.
00:37You will notice up at the top in the title bar I've got a database open
00:41called CustomerOrdersA.
00:43If you've got exercise files, you can go to the Lesson 9 folder and open up this
00:47database first and then what we will do is come over to our Navigation Pane here
00:52and click on the Customers form.
00:54So we saw this from a previous lesson.
00:57We even created a Command button here to print out our form.
01:02What if we wanted to view a report now?
01:04We could create a button right below the Print button that opens up the
01:08Customers Phone List for example, so we don't have to do it manually.
01:12We can do it right from here.
01:14If we are going to be creating an application that users are going to use this
01:17form to input new customers, they may want to, at any time be able to look at
01:21the Customers Phone List report.
01:23So let's automate that.
01:24The first thing we need to do is go up to the Create tab and way over here on
01:30the right, you are going to see a Macro drop-down.
01:32If I click the drop-down, you will see I have got Macro, which is the
01:36default button up here.
01:37I can also create Modules and Class Modules.
01:40That's fairly advanced and would be saved for another title.
01:44So we are going to go right up to Macro and we are going to give it a click.
01:46It opens up the Macro1 tab.
01:49We haven't saved our Macro and given it a name.
01:51So this is the default that shows up here, Macro1 and you can see some columns.
01:55You got an Action column.
01:56We have got a Comment column and I skipped over this one called Arguments,
02:00because this is brand new to version 2007.
02:04You can't go in to the Arguments column and make any changes and any edits,
02:08but you can view the Arguments that are being created depending on the action you choose.
02:13So as I mentioned, we wanted to make it so that the users inputting data into
02:17the Customers form can quickly run a report called Customer Phone List.
02:21So that's going to be the action.
02:23I am going to click the drop-down here and you can see I've got quite a long list.
02:27It's an alphabetical list of all the things, all the actions that can take
02:31place in this Macro.
02:32And of course, a Macro can be a series of actions.
02:34You can see I can close up the database.
02:37I can use the Find feature.
02:39Here is the GoTo feature.
02:42I am going to scroll down and down here in the Open section.
02:47You can see I can open Forms, Queries, Reports, Tables. There is Report.
02:50OpenReport is what I am going to click on and you are going to see
02:54some arguments show up.
02:55I can't edit those, but down below in the Action Arguments section is where I
02:59actually choose the report that I want to open.
03:02So where it says Report Name, I am going to click just at the right.
03:05That gives me a drop-down that I can click on to choose from the reports in
03:09this database and the one that I do want to run or open up is the Customers Phone List.
03:15So I am going to give that one a click.
03:17The view that it comes up in will be a Report view by default, but if I wanted
03:21it to come in Print Preview for example, so it would be fast and easy to
03:24print, I can change the view by clicking this drop-down and I am going to go
03:29down to Print Preview.
03:30You can see the other views are there as well, Print, Design, Layout.
03:35We will choose Print Preview.
03:38Now if I want to apply a filter that would exist in a query for example, I
03:42could do that here.
03:44I can add conditions.
03:45That's a little bit more advanced, so we are going to save that for later.
03:48Right now, we are done with our Macro, so we will go up to the Save button first
03:52and we will give it a name.
03:55So this one is going to be a Macro that runs a report, so let's do Phone List.
04:01PhoneListReport just like that and we will click OK.
04:08Now it doesn't need to show up on the form like that, but it just helps us in
04:11the Navigation Pane to understand what this Macro does when we see it over here on the left.
04:16All right, to run this report now, all we have to do is come up here to the Run
04:20button to test it out and when I click the Run button, look what happens.
04:25The Customers Phone List is opened up for me.
04:28Notice also that I am in Print Preview mode here and I can close the Print Preview.
04:33It takes me back to my Macro and I am done with this Macro, so we are going to
04:39test it out in our Customers form.
04:41So when I close this Macro by right- clicking and selecting Close, I am taken
04:48back to my Customers form.
04:49All I need to do now is attach this Macro somewhere to this form.
04:54That's what we are going to do in the next lesson.
Collapse this transcript
Attaching macros
00:00The very first step in using a Macro is to obviously, create that Macro.
00:05That's what we did in the previous lesson and now it's time to take the second
00:09step, which is to attach it to something to make it easily accessible.
00:13So in our scenario here, where we are going to have users entering customer
00:17information into this Customers form that you see on my screen here, we want to
00:21build in some kind of automation so that they can run this Macro called
00:25PhoneListReport that we created in the previous lesson and we know that that
00:28actually launches a report, the Customers Phone List report in a Print Preview
00:34screen, so it's easy to print out.
00:36So we are going to build-in the automation by attaching the Macro to this form.
00:40We will create a button that allows us to do that and then for our users who are
00:44entering the customer information, it will be easy just to click a button and be
00:47able to print out that phone list.
00:50So let's do that now.
00:51If you have been following along in the previous lesson, you created the Macro.
00:54We are looking the Customers form.
00:56If you are jumping to this lesson, and you have got the exercise files, go to
01:00your Lesson_9 folder and open up CustomerOrdersB.
01:03You will find it in there and once you have got it, go over here to the
01:08Navigation Pane and click on the Customers form.
01:11You will be all caught-up with us.
01:11In the previous lesson, we added a button here, which is Quick Print button that
01:17prints out the form.
01:18We added that not as a Macro, but just as an Action.
01:21Now we know that from the previous lesson on Macro is at least one or more
01:26Actions strung together into one automated process.
01:30So what we are going to do is add our new Macro button down here and we do the
01:34exact same thing that we did to add this Print button.
01:37We switch to Design View for our forms, so we will go up to the View button,
01:41click the drop-down and select Design View.
01:43I am going to slide over here to the right, so I can see where that Print button
01:49is because I want to put it right underneath and we come up here to the Control
01:52section on the ribbon and click on the Button.
01:55So I am just going to click-and -drag a box here and release.
02:00Now that's just a starting point.
02:01I can adjust that later.
02:03You can see over here in my Command Button Wizard, because I have got this
02:07button selected up here, I have got some options for Record Navigation, Record
02:13Operations, Form Operations that's what we used earlier to print a form.
02:18There is Report Operations as well.
02:21I am not actually going to open the report and then switch to Print Preview.
02:24We've got all of that together in one Macro.
02:27So we are going to come down to Miscellaneous down here and choose to run a Macro instead.
02:33When I hit Next, I get to choose which Macro I am going to run.
02:38Now there is only one Macro in this database, so it's listed right there.
02:42It's already highlighted.
02:43I just have to hit Next.
02:45Now do I want it to show text on the button or would I rather have a picture there?
02:50Well, let's try Text just to see what that looks like.
02:52We will type in PhoneList and then we will hit Next.
03:00Now we get to name our button and that's only to make it easy for us.
03:03Nobody sees this but us, the designers of the database, so we understand what
03:07our different buttons do and we look at all of those objects.
03:10Right now, it just says Command46.
03:12We are just going to be PhoneListMacro.
03:15That's what I am going to type in.
03:18That will help me remember what this button is for and then I will hit Finish.
03:22So you can see what happens here.
03:24I have got my button.
03:26Right now, the text color is not working very well for me, because it's a white
03:30on a very light gray, so I can change that.
03:32If I click inside the button here and highlight, you can barely see Phone List in there.
03:37I am going to change my font color.
03:39I am going to a black and I am going to size this a little bit differently, make
03:48it a little bit taller.
03:49Let's see if we can squeeze it in to two lines, just like that.
03:53We will line it up underneath our Print button and I am going to deselect by
03:58clicking outside the selected box to see what that looks like. Interesting.
04:02So all we need to do now is save our changes to our form, because we are in Design View.
04:06We need to save those changes and let's switch back to the Form View.
04:11This is where we started.
04:12Now underneath our Print button, we have got our Phone List button.
04:15Let's see if that works.
04:17We will click Phone List.
04:18It runs the Macro, which opens up in Print Preview, our Customers Phone List report.
04:25We can zoom in and zoom out just like we did when we created this report and if
04:30we wanted to, it would be nice and easy just to print it off.
04:34I am going to click the Close Print Preview, which is going to return me to my form.
04:40So you can see how this would be very useful as a user is entering new
04:44customers, obviously, the phone list is being updated and they can run that
04:49phone list even printed quite easily with some automation that we built in using
04:53an existing Macro, we just simply attached it to the form where it's easy for
04:58our user to get access to.
Collapse this transcript
Automating data entry with macros
00:01I've got to tell you.
00:01We could devote an entire title to working with Macros in Microsoft Access 2007
00:06and it would be hours long.
00:08Well, we are not going to go into that much detail in this title, but I do want
00:11to cover a couple of scenarios where Macros can be very useful, and one of those
00:15scenarios is automating data input.
00:18So if you have got users who are going to be inputting information into various
00:22tables using forms that you have created for example, and you want to build some
00:26automation into that, you can use Macros to do it.
00:29So here is the typical scenario.
00:30Let's say that most of our customers reside in the area or let's say the city
00:35where our business exists.
00:37So I am going to use Manotick, PA for example.
00:40Now every time we add a new customer where the city is Manotick, wouldn't it be
00:43nice if the state PA was filled in for us and we are automatically taken to the
00:47next field, the Zip code where we can enter that?
00:50That's what we are going to do in this lesson.
00:52We are going to build a Macro that recognizes the city, inputs the state for us,
00:56and then moves on to the next field.
00:59So the very first thing you will need to do if you are skipping to this lesson
01:02is open up CustomerOrdersC from the Lesson 9 folder of your exercise files.
01:07And if you have been following along and you have the exercise files, you can
01:10keep the existing database open.
01:12So we are going to use the customers form, but we need to flip to Design View.
01:16And another thing that's kind of cool about Access 2007 is we can embed the
01:21Macro right here in the form, we don't have to create a separate object like we
01:25did in the previous lesson.
01:26We will just embed it right here by selecting the field that we want to run the Macro on.
01:31In this case it's the City field.
01:33So when I click on City, I want to make sure that the Property Sheet is open.
01:36So if it's not, click the Property Sheet button, so you can see all of the
01:40properties over here.
01:41What we want to do is as we exit this field, if the city is equal to, in our
01:47case Manotick, we want the State field to be populated with PA and we want to
01:52the take the user straight to the Zip field.
01:55So with City selected, we are going to come over here to the On Exit event.
02:01So if the Event tab is not selected, give it a click.
02:04Go to the right of On Exit and click in there.
02:07Next thing we are going to do is build a Macro.
02:09So we are going to click on the ellipses here, and with Macro Builder
02:14selected we will click OK.
02:15So you can see here I have got some columns, I have got the Action column,
02:20Arguments, that's new in 2007, and we got a Comment column over here as well.
02:24The other one that we need is the Conditions column.
02:26So I am going to click on that and then something that's very important for this
02:31particular scenario where we are going to be setting a value for a specific
02:35field is to show all actions.
02:37By default, if we come into the Action column here and click the drop-down, we
02:41are only going to see Actions that are safe according to Microsoft Access.
02:46So what we are going to do is choose Show All Actions.
02:49That's going to increase the list of possibilities here including one that we
02:53are going to need in a moment.
02:54The first thing I am going to do though is use the first row here for a comment
02:58only, and the comments is just going to remind me what this Macro does.
03:02So it Sets State value to PA when Manotick is entered in City field.
03:19That's just for my own purposes.
03:21I am going to go to the next row and set up the Condition.
03:24So the Condition, I can type this in if I know how to code it properly or if I
03:29wanted to I could use the Builder.
03:31Well, I know how to type these in.
03:33You can do the same thing using your own city, if you like.
03:36So I am going to put in [City].
03:40That's the name of the field.
03:43In and I am going to put in a round bracket and each of the cities I enter here
03:48have to be in double quotes, and I can do more than one, if I wanted to.
03:54Let's say Harrisburg is another option. It's very popular.
03:57I could add that too.
03:59It's also in PA and I am going to close it up with a round bracket.
04:02So you could see I could enter as many cities here as I want.
04:06So what is the action when one of the cities equal Manotick or Harrisburg.
04:10Well, the action when I click the drop down is to set a value, but not in this field.
04:14In another field.
04:15So watch what happens.
04:17Remember, this is the On Exit command or Event.
04:21So I am going to scroll all the way down to find SetValue. There it is.
04:26I won't see that unless Show All Actions is selected up here.
04:30And the SetValue gives me some options down below, Item and Expression.
04:37So I am going to click in the Item field and you can see I have got a little
04:41Builder over here as well.
04:44But really all I want to do is set it up so that the state is going to show up
04:48with a certain value.
04:50So I know that fields have to be in square brackets, I am going to type in
04:53state, close it up with a square bracket.
04:56And then down below the Expression.
04:58Again, I have got a Builder if I want help.
05:00But I am going to just type in "PA" like so. And I am done.
05:07Well, almost done.
05:10The next thing that I want is for Access to take me to the Zip code
05:15field automatically.
05:17So I am going to click in the next row down here and what I am going to do is
05:22add in a command or a condition that continues from the previous condition.
05:28I don't know if you understand that, but all we need to do, when you look
05:33down here in the bottom right corner is Enter a conditional expression in this column.
05:37Type three periods to apply the condition from the previous row.
05:42So I want this and then ...
05:44I am going to come over to the Action column here and I am going to choose a
05:51GoToControl right here and the control -- I am going to click down here and the
05:58control that I am going to is my Zip code, which of course because it's a
06:03field or a control.
06:04It goes into those square brackets.
06:06I type in Zip, close it up.
06:09I am going to click over here.
06:11If I want to add a comment, I could.
06:14It ... goes to Zip field after entering PA.
06:24All right, I need to do now is save this.
06:27You can see up here, by default because I am working with the City field in my
06:31Customers form, I have got Customers: City:On Exit showing up. That's fine.
06:36If I want to change the name, I could.
06:38I am going to hit Save and we are going to test this out.
06:42So I am going to close this.
06:44I am going to go to my Form View and I am going to try adding a new record.
06:53So from here, let's see what happens if I come into the City field and type in
06:57Manotick and press Enter.
06:59You can see what happened.
07:00PA was entered for me and it took me right over to Zip.
07:04So two things are going to happen when we automate things for users like this.
07:08One, it's going to save some time.
07:10I don't have to stop at this field and enter PA every time.
07:13Another thing that's going to happen is I am going to have accurate data.
07:17So I won't be able to get a spelling mistake put in here, and maybe Pennsylvania
07:21would be typed up by someone when it should be PA or Pa which could make a
07:26difference later on when we do filtering and sorting and searching for records.
07:32So one of the scenarios that is very useful when using Macros in Microsoft
07:36Access 2007 is to build some automation into data entry like we did here.
07:41Use your imagination.
07:42Come up with your own using some of the rules and some of the techniques you
07:47learned in this lesson.
Collapse this transcript
Validating data with macros
00:00Another great use for Macros in Microsoft Access is to validate your data.
00:05That is to ensure its correctness.
00:07Here's a scenario, let's say we have somebody entering orders for us in a form
00:11that we created called Orders and the information that goes into the Order form
00:15populates the Orders table.
00:17But we wouldn't want someone entering information and moving on to the next
00:21order if they hadn't filled in all the required fields.
00:24For example, let's say they filled out everything except the
00:27Product information.
00:28Well, then we would have an order in our Orders table with no products to be ordered.
00:32That wouldn't make sense.
00:34So we can create a macro that sends up a message saying that they have left
00:37something blank, send them back to that field so they can enter the information
00:41before they are allowed to move on to the next record.
00:44That's what we are going to do in this scenario.
00:46Now you can see up to the top here, I am using CustomerOrdersD from the Lesson 9
00:50folder of the Exercise Files.
00:52If you have been following along and you have the Exercise Files you don't need
00:56to open this one up.
00:57You can continue to follow along.
00:58If you are jumping to this lesson however, go to your Lesson 9 folder and
01:02open up this database.
01:04The next thing you can do is actually go to the Orders form, so we can all come
01:08down here to the Navigation Pane and click on the Orders form.
01:12It's a very simple form, but we are going to set up some validation rules using a macro now.
01:18So let's say we want to make sure of that, no matter what if the Product ID
01:21field is left empty, they are not allowed to save that record and move on to the next one.
01:26Now you know when you are entering data into a form, the information is
01:30automatically updated when you move on to the next record.
01:33We want to stop that, if the Product ID field is left empty.
01:37Now, unlike the previous lesson, we don't zero in on a particular field, we look
01:41at the properties for this entire form.
01:43So let's switch to Design View first of all, click the View drop-down and
01:47select Design View.
01:49Next, we are not actually going to select any of these fields in the Detail section.
01:53We are just going to look at the Form properties, so the Property Sheet must be
01:57open and if it's not, you can give it a click up here in the ribbon and next, we
02:03are going to come down to this event.
02:05So, you will have to click on the Event tab and make sure that you are clicking
02:08to the right of Before Update.
02:14So, here is where we are going to set up and event that will happen before this
02:17record can be updated in this Form.
02:20So, we can use the Builder for this we will click on the ellipsis over here.
02:24Select Macro Builder if necessary and click OK, we have seen before in
02:30the previous lesson.
02:31The next thing we are going to do is set up a condition.
02:33So we need to view the Conditions column by clicking Conditions up here and in
02:38the Condition column here, let's put in a condition that says if that Product ID
02:43field is empty, to take some kind of Action that would be to cancel the Event
02:47and then we will have some further actions to take place in this Macro.
02:51Now, we can type that in or we can use the Builder.
02:54I am going to start off with the Builder, give it a click and I am going to
02:58go down to my Forms, double-click that, double click Loaded Forms and click on Orders.
03:06Here is where I see a list of all of the content of this particular form
03:10including Labels, Titles, but it's the Product ID field that's important to me.
03:17So I am going to click Product ID and I am going to actually double-click
03:20that with Value selected over here on the right, to enter that up here in my
03:25Expression Builder.
03:27Next I am going to type in, Is Null, so that means if the Product ID is left
03:33empty something is going to happen.
03:35So, when I click OK, you can see that's actually entered for me, I could have type this in.
03:39Now, I go over to the Action column and what is the Action I want to happen.
03:44I want to cancel the event, so I am going to click CancelEvent.
03:48Because remember the event we are working on is Before Update and if I wanted to
03:53I could put in Comments here just to clarify what's happening in my Macro.
03:57Now, I want more things to happen so, I am going to click in the
04:00Condition column underneath my first condition and put in my three dots,
04:04here is the ellipsis.
04:05That means continue on.
04:07After it's canceled then what?
04:09How about a message pops-up?
04:11So we will come in here and scroll down to MsgBox.
04:15There it is and some information shows up down below.
04:19We can enter our message.
04:20This is what's going to show up for the people who accidentally leave the
04:23Product ID field empty.
04:25I am going to type in 'You must enter a Product ID.' Yes, there is going to be a Beep.
04:34The Type down here, if we click next to None and click the drop-down you will
04:37see this could be no specific type of message or it could be a Critical message,
04:42a Warning it could be a Warning!
04:44So we are going to see a different icon depending on what we choose here.
04:49We are going to provide this for the person's information, so I am going to
04:52select Information here and then if we want information showing up in that
04:56actual MsgBox in the Title bar we can enter that here, Information Required,
05:03how about, there we go.
05:06So, there's our second actual Event that's going to happen in this Macro and
05:11then the third thing I would like to add another one, three more dots and over
05:14here on the Action column I would like to take that person to the empty field so
05:18that they are just right there ready to enter whatever was missing.
05:21So for us, that means going to an actual control on the Form, so GoToControl,
05:27down below we type in the name of Control.
05:29Remember from previous lessons we need square brackets, so here's my left square
05:34bracket and Product ID is the control or the field that we need to go to.
05:41So, once we have entered that we are ready to go.
05:44So I am going to come up here and I am going to hit Save.
05:47I will save my changes.
05:49I am going to close up my actual Macro.
05:53Now this is an embedded macro.
05:54It's built into the form.
05:56You don't see it as an object over here on our Navigation Pane.
05:59All we have to do now is test it out.
06:01So let's go back to the Form View, we will come down here to New, I am going to
06:05click right in here Customer ID, let's say the same customer is going to place
06:09another order, so Customer 8.
06:11I am going to tab pass the Product ID and test this out.
06:15Let's say the Quantity is going to be 1 and the price 349.
06:20Now, watch what happens when I hit tab to move to the next record. I hear the beep.
06:25It says You must enter a Product ID.
06:27There's my title Information Required.
06:30When I click OK, look where my cursor is flashing in the Product ID.
06:34So, I type that in.
06:36Now I can tab across and start a new record.
06:39So, just another scenario where Macros can be very useful in validating the
06:44information that's going into your form and eventually into the table.
06:49Keep in mind that there's a number of options that we can use when validating data.
06:53You might want to practice this one on the Customer ID field, maybe if that's
06:58left blank, we should also have some kind of warning and take the person back
07:01and not allow them to update this form without a Customer ID.
07:05So, if you really want to practice this, do the exact same thing we just did
07:08with the Product ID field in the Form properties, do it for Customer ID and you
07:13will be an expert by the end.
Collapse this transcript
Creating auto-executing macros
00:00Let's talk about one more kind of Macro that automatically runs every time you
00:04launch your database.
00:06It's the AutoExec Macro.
00:08And by having an AutoExec Macro in your database, every time it's launched, you
00:12can control what appears on the screen.
00:15For example, if you have created a Switchboard like we did a couple of
00:18lessons ago, then you may want that presented to the user every time they
00:22launch the application.
00:23The last work, we are going to do in this lesson and before you can began, if
00:27you have got Exercise Files, you'll need to go to your Lesson9 folder and
00:30open up MyApplication.
00:31Now over here on the left you can see we do have a Switchboard.
00:35This is something, we created quite a few lessons ago, if I click on the
00:39Switchboard, you can see I have got a few buttons here for adding new customers
00:42products and orders.
00:44I think it would be good if this main menu that switchboard showed up every
00:48time, we launch the application.
00:50So that's what we are going to do, we are going to create a Macro that does this.
00:53First, we are going to go up to the Create tab on the ribbon and I am going
00:57to go all the way to the right and click on Macro and this is going to be a very simple Macro.
01:02We can put all kinds of controls into what people are allowed to see and do into
01:07an AutoExec Macro, but we will save that for a more advanced title right now.
01:11We are going to keep this simple.
01:12We are going to present the Switchboard every time, we launch this database.
01:16So, the action from the drop-down here is simply going to be to open a form.
01:20So you scroll down to OpenForm, down below in the Form Name field.
01:26We'll click and from the drop-down select our Switchboard.
01:31That's all we need to do.
01:32We don't need filter names or 'where' conditions or Data Modes or Window Modes,
01:36everything is perfect just the way it is.
01:38What's very, very important though is that we name this Macro correctly, so that
01:43it does automatically execute when we launch this database.
01:47So, when we go up to the Save button.
01:49It's very important that you call this AutoExec.
01:53And I am using capitals for the A and E. You don't need to.
01:58It can be all lower-case. That's fine.
02:00But it has to be AutoExec and when you click OK, it now appears on the
02:05Navigation Pane over on the left and this will automatically execute now the
02:10next time, we launch the application.
02:12We are going to test it out.
02:13So, first I am going to go up to this tab right-click and close the Macro.
02:17The other thing is I am going to minimize this Navigation Pane because that's
02:22the view I want people to see when they come in. All right!
02:24So, I am going to close this up, I am going to go up to the very top and close
02:29the entire database.
02:31I have already got my Lesson9 folder open from the Exercise Files.
02:34There is MyApplication, the one we just saved up, so I am going to double-click it.
02:40Watch what happens, boom!
02:42I am taking straight to the main menu and there is my buttons for adding new
02:45customers products and orders.
02:48So thanks to the AutoExec Macro, I've a lot of control over what people see when
02:53they come into this database.
Collapse this transcript
10. Sharing Data with Word and Excel
Importing data into Access
00:00So far in this title, we've spent a great deal of time and energy investigating
00:04different ways to design and create objects in Microsoft Access.
00:08We've looked at tables and forms and queries and reports.
00:12We've looked at different ways to get data into your Access database as well.
00:15We could either directly into a table or use a form to make it easier and more
00:20comfortable for entering data into a database.
00:23But what if you have already got a lot of the data existing elsewhere.
00:26A typical scenario is people will use spreadsheets to track information and
00:30store data and then realize later maybe they should be using a database
00:34application like Access.
00:36And now they have already got all of that data sitting in an Excel spreadsheet
00:39and they want to get it over into Access.
00:42And we can do that quite easily actually.
00:44That's exactly what we we're going to do in this lesson.
00:46If you look at the Title bar at the top of my screen, you can see I am using a
00:49database called CustomersA.
00:51It's in the Lesson10 folder of your Exercise Files.
00:54So you can go ahead and open that up.
00:56Now we can be creating a brand new database from scratch, and import data into a
01:00table or like this scenario, we may have already started our database and now
01:05it's time to go get that information later on.
01:08I have already got some tables, some forms, I have even got, if you look down
01:12here a Macro from a previous lesson.
01:14So, now I want to bring in my customer information. How do I do that?
01:18Well, I am going to go to be actually importing what's called External data.
01:23So, from here, I am going to go up to the External Data tab and you'll see I
01:26have got options for importing.
01:28I have got exporting.
01:30I can collect data and I have got a whole bunch of SharePoint Lists as well.
01:34So, let's say I want to go get information from an Excel spreadsheet.
01:37It happens to be one of the choices here in the Import section of my ribbon.
01:41So I am going to click on Excel.
01:46And I am going to specify the source my data now.
01:48So, I need to browse to that actual data, that Excel spreadsheet.
01:52I am going to go hit the Browse button.
01:54And we'll navigate to the Exercise Files.
01:58Again, it's Lesson10, so double-click the Lesson10 folder and you can see I have
02:02got a Customers spreadsheet here.
02:04So, I am going to click on it and click Open.
02:07That shows up now in the File Name field, perfect, but I have got some options
02:12down below to think about.
02:13Do I want to import this data into a brand new table in my database?
02:18Well, that's what's selected by default and it also happens to be what we want to do.
02:23But other options could be to append that information to an existing table.
02:27So, if I already had a customers table and I had all of the fields setup, the
02:32same way they are set up in my Excel spreadsheet, then I could simply add them
02:36to the bottom of the table.
02:38The other option is to link to the data source by creating what's called a Linked Table.
02:42And that's kind of handy because this information gets updated in the Excel spreadsheet.
02:46It gets updated in my Access database but not the other way around.
02:50So, the most common scenario is to import source data that exists somewhere
02:54else, our Excel spreadsheet into a brand new table here in Access.
02:59So with that selected, I am going to click OK and now I am going to have a few
03:03questions to answer.
03:04You can see I am using the Import spreadsheet Wizard, and if you look at the
03:08data down below that's coming in, and that's first row is actually Labels, isn't it?
03:12Well, I have got a Checkbox up here.
03:15The First Row Contains Column Headings, if I check it, you can see what
03:18happens, beautiful.
03:20And everything else down below would be an actual record.
03:23All right, ready to move on to the next step.
03:28Here is where we actually get to choose options for the various fields that are
03:32going to show up in our new table.
03:34And you can see the first one Customer ID is selected.
03:37The Field Name is Customer ID, if I want to change that name I could.
03:41If I don't want, I can leave it.
03:42The Data Type, I am going to change.
03:44It doesn't need to be Double.
03:46It's very short number, just a Customer ID.
03:48I am going to go down to Integer. Is it Indexed?
03:52Well, you know what, this is going to end up being our primary key, isn't it?
03:55We don't want any duplicates here.
03:57That means Yes, it's indexed and duplicates are not okay.
04:01So, I am going to click this drop- down and choose Yes, with no duplicates.
04:06And you can see I also have an option to not even Import this field, but I do want to import.
04:11And if there are other fields I want to work with, I could as well just by
04:14clicking them, for example, if I go over to State, you can see it is a
04:20Text Field, perfect.
04:21That's what I want. It's not Indexed.
04:23Everything seems to be okay.
04:25The Zip Field, even though it's all numbers, it should be a Text Field and it is.
04:29So, our Access is pretty smart in figuring out what your field should be.
04:33I am going to click Next.
04:36Now look what's happening.
04:37Access is wondering if it should add a column in here, a new field called ID
04:41to be the primary key.
04:43And if we let Access add the primary key that's what would happen.
04:46But we already know our Customer ID is going to be our primary key.
04:50So I am going to say instead of no primary key, Choose my own primary key.
04:55And by default the Customer ID gets slotted in as the primary key and that's
05:00perfect that's just what we want. So we click Next.
05:03Now it just time to give it a name, Customers is going to be fine for me.
05:08If I want I can have the Wizard analyze my table after importing the data, but I
05:12am pretty confident.
05:13It's going to be okay.
05:14So, I am going to click Finish.
05:16And this is kind of neat.
05:18I can save those import steps.
05:20That means if I need to do this again at a later date, I won't need to go
05:23through all those selections and those various steps by saving the import steps,
05:28I just run the Import next time and I would save my import using a name.
05:32I can put in a Description, even create an Outlook task, if I wanted to do that.
05:36But I am not going to save the imports, so I am going to deselect that.
05:40And just choose Close.
05:43So, right away, look what happened.
05:45I've now got a new Customers : Table and if I click on Customers : Table, it
05:49shows up with my Customer ID that's my primary key and then each of the field
05:54shows up just as they were entered into that in Microsoft Excel spreadsheet.
05:59So, if you've already got data existing in an Excel spreadsheet and you are
06:03converting over to a database, I don't think you have to retype or re enter that
06:08data, if you have already got it, just import it into Microsoft Access.
Collapse this transcript
Using Package and Sign
00:00Sharing a Microsoft Access Database is a little bit different than sharing, say,
00:04a simple Word Document or PowerPoint Presentation.
00:08We now know that a Microsoft Access database can contain many objects like
00:12Tables and Forms, Reports and more importantly little programs called Macros.
00:19They can be objects or they can be hidden inside other objects like Forms, for example.
00:23You can even add VBA coding to a Microsoft Access database and for that reason,
00:28Access databases can be considered dangerous as soon as you get Macros and VBA
00:33coding built into a database, well, people can use that for a malicious reasons.
00:38So we are going to look at a feature that allows us to package up our database
00:41and sign it digitally before we share to increase trust levels.
00:45You want to make sure if you are receiving a database from someone else that you
00:49can trust the source and the content of that database and that's what we are
00:52going to do in this lesson.
00:54So if you've got exercise_files, go to the lesson_10 folder of those
00:57exercise files and open up CustomersB and we are ready to start the Package
01:02and Sign routine but before we do, we have to have at least one digital
01:07signature to apply.
01:09So I am going to show you how to do that now in case you have never done it before.
01:12We are going to go down to the Start button, and in the Start Search field down
01:16here in Windows Vista, I am just going to type in Digital and you can see right
01:21at the top under Programs, I get Digital Certificate for VBA Projects.
01:25You can navigate to that by going through All Programs, going to Microsoft
01:29Office, and then there is a Microsoft Office Tools folder where you'll find this
01:34but this is a lot faster.
01:35So I click on Digital Certificate for VBA Projects and here is where I can
01:39create my own digital certificate.
01:42Now keep in mind it's a self-signed digital certificate that will bear my name
01:47and since it's a self-signed digital certificate, it could be forgery somebody
01:52could be in here creating a certificate with my name on it, obviously.
01:56So it's not the most secure version of a digital certificate.
01:59Now you can get a commercial certificate through commercial certificate
02:04authorities and there is a link here to get a list of those.
02:07Of course, you've got to pay money for those but they are a little bit more
02:10trustworthy, so if you wanted to go that route you could but for this particular
02:15lesson we are going to create our own self-signed digital certificate and we are
02:18going to add the name down here where it says Your certificate's name.
02:21So I am going to type in David Rivers, I am going to put in a dash here and
02:28put in - Databases. And click OK.
02:31So I have successfully created a new certificate for David Rivers -
02:38Databases and I click OK.
02:39That means now when I go through the Package and Sign routine, I will be able to
02:44choose that certificate.
02:45You'll find that under the Office button, so click the Office button.
02:50We come down to Publish and that's where we find Package and Sign, so give it a
02:55click and you can see I have got my certificate right here, Issued To, I am
02:59going to spread out these column so you can read David Rivers - Databases.
03:03Issued By should be the same thing, yup.
03:06And Intended Purposes, Code Signing, there was no no Friendly Name applied
03:10to it and you can see an Expiration date.
03:12All that was setup by default for me, so I am going to click on OK and now I get
03:19to choose the name for my Package database.
03:22Keep in mind that this is going to be an Access sign or package, so it's not
03:26going to be just the database.
03:27People will have to extract the database from this package when they receive it.
03:32So the file name CustomersB is fine but I am going to put it on my desktop.
03:36So I am going to click Desktop, leave it called CustomersB and that's just based
03:41on the name of the actual database itself and click Create.
03:45It takes some moment and it's done.
03:47Now I am still in my database here in Microsoft Access working way but if I
03:52minimize this and go back to my Desktop, you'll see that I have actually got one
03:57called CustomersB here.
03:59There is the Access symbol but it's also got this certificate.
04:02So when I double-click this, see what happens Microsoft Office Access Security
04:08Notice shows up, indicating there is a potential security concern and that is
04:13the digital signature is valid, but the signature from a publisher whom you have
04:18not yet chosen to trust is what's showing up here.
04:21In other words, I haven't actually added that signature to my list of trusted sites.
04:26So you can see the file path here where it's located.
04:30The option I have is to Trust All.
04:33That means everything I receive from this publisher or I can open it up.
04:36Now I am going to click Trust All from Publisher, which now shows on Window
04:41where I can extract the database to.
04:43Now I am going to extract it right to the desktop.
04:46I am going to click OK and I am going to minimize Microsoft Access just to show
04:56you that it's there but it did open up.
04:59You can see I have got two.
04:59I have got the one that I am working on.
05:01It's locked and CustomersB right here.
05:04It's as easy as that, I am going to foot back to the one I just extracted from
05:08that package using the Package and Sign feature.
05:11It's quite simple, keep in mind if you are going to use it you need to have a
05:15digital signature whether it's self -signed or you have got one from a
05:18commercial organization.
05:20Either way you need to have one of those signatures to apply to the package
05:23before it can be compressed and ready to be sent off.
Collapse this transcript
Sharing via email
00:00In this lesson, we're going to look at yet another way to share Microsoft Access
00:04data with others and that's via e-mail.
00:07Now in Access 2007, we can choose to share a part of our database such as a
00:12report or a form, for example or we can share the entire database and I'm going
00:17to show you both ways.
00:18Let's start with sharing a single object from our database.
00:22Of course, if you're following along in previous lessons, then you can just use
00:26the existing database you may have open right now.
00:29If you're jumping to this lesson and you have Exercise Files, go to the Lesson10
00:33folder, and open up CustomersC.
00:34That will get you all caught-up.
00:37Next, we're going to select the actual object we want to share.
00:41A typical scenario is to share a report with others via e-mail.
00:45So, I'm going to click on the Order Totals report.
00:47That opens it up over here where I can see it.
00:50This is exactly what I want to send off to either one or more people via e-mail.
00:55To do that, it's very simple.
00:57I just go up to the office button and select E-mail.
01:01Next, the Send Object As dialog box shows up and I get to choose the format I
01:05want to save this report in, before it gets attached to the e-mail and gets sent off.
01:10If I want folks to open up my report in a web browser, I would choose HTML.
01:15If I'd like people to be able to open it up in their default Word Processor
01:19like Microsoft Word for example, Rich Text Format or even Text File Format would be good.
01:23If I want people to see a snapshot of my report, so, not an actual report, but
01:29almost like a picture of my report, I can choose this format called Snapshot.
01:33I'm going to leave it at Rich Text Format.
01:36That way folks who have Microsoft Word or any other Word Processor will be able
01:40to open it up and I'm going to click OK.
01:43Right away Access jumps into action launching my default e-mail application,
01:47which is Microsoft Outlook, and you can see that the file is actually already
01:51attached and converted to RTF.
01:54So, it's sitting there waiting for me to send it off to whoever I want.
01:57So, I'm going to type in an address here, I'm going to type in my own address.
02:02I could add as many people here at Distribution List, but I'm going to send
02:05this to one person.
02:07The Subject, which is optional, is going to be Latest numbers on Orders and down
02:16below, if I wanted to include a message I could.
02:18Just click down here, I'm just going to type in See attached report, just like that.
02:25I'll hit the Send button and off goes this report to that e-mail recipient, easy as that.
02:31Now, what if I wanted to send this entire database, so, all of these objects in a database?
02:37Well, in the previous lesson you may recall, we talked about the
02:40Package-and-Sign feature, and that allowed us to package all of the objects in
02:44our database into one file.
02:46It would compress it, so that it would be easy to e-mail or download.
02:50We could even add a digital signature to create some authenticity.
02:54While that's what we're going to do now, but not from Access, we're going to go
02:57down to our Start button and launch our default e-mail application.
03:02Mine is Outlook, so I'm going to select it and I'm going to create a new message.
03:07In here, I'm going to add an attachment, so I'm going to come up here, not this
03:11one here, attaching an item would be attaching another e-mail message, but this
03:14one right up here, the paper-clip, when I click Attach File, I just need to go
03:18browsing now to my Exercise Files.
03:21So, go ahead to the Lesson10 of the Exercise Files and find CustomersPkg.
03:28You'll notice that this little icon looks different from the others.
03:31It's got that certificate.
03:33So, this is what we use, the Package-and-Sign feature.
03:36So, I'm going to double-click it or one click and Insert attaches it down
03:41here in my message.
03:42Now, all I have to do is type in who I'm sending it to, send it to the same person.
03:48Again, a subject and when I hit Send, the entire database is sent off in a
04:02package to the recipient.
04:03I'm going to close Microsoft Outlook.
04:05It takes me back to Access where I'm looking at my Order Totals Report.
04:10So, there you have a couple of different ways via e-mail to share your data with others.
04:16It can be a single object, by selecting it from the Navigation Pane here in
04:20Access or it can be your entire database, if you use that Package-and-Sign
04:24feature we've talked about in the previous lesson.
Collapse this transcript
Exporting data to Excel
00:00A few lessons ago, we learned how easy it was to import data from Microsoft
00:05Excel into Microsoft Access and create a brand new table out of that.
00:09Well, the reverse is equally as easy.
00:12We can take data that exists in Microsoft Access, like a table or query results
00:16for example, and export that to other formats, including Microsoft Excel.
00:21So, let's take a look at the Export feature in Microsoft Access now.
00:25If you are jumping to this lesson and you want to follow along, you've got
00:28the exercise files, go to the Lesson 10 folder of those exercise files and
00:32open up CustomersC.
00:34We were using that in the previous lesson, so if you are following along, you
00:37are good where you are.
00:39Next, we are going to go up to the External Data tab and here is where we
00:44see the Export section.
00:46Now, you'll notice right now that Excel and SharePoint List, they are grayed out.
00:51Why is that?
00:52Well, right now I am looking at a report, so I couldn't export a report to
00:55Excel, but I could to a Word document, we did that in the previous lesson using
01:00our Email function or a Text File.
01:02There are some other formats.
01:04If we click the More drop-down, you can see we either could export this to an
01:07Access Database, an XML File.
01:09There is that Snapshot format, even an HTML Document.
01:13Well, let's go over here now and click on the Customers: Table.
01:16As soon as I do that, look what happens up here, the Excel and SharePoint list is available.
01:22If I click the More drop-down, I have got many more options to choose from as
01:26well, like dBASE, Paradox, Lotus.
01:29I can even take this table and merge it with Microsoft Office Word and use
01:33this in a Mail Merge. So that's awesome.
01:36But we are going to export this to Microsoft Excel, so all we need to do is
01:40click this button right here in the Export section on the Ribbon.
01:44Now, we have some options to choose from, like the name of our file and its
01:48location and you can see by default, it's going to be called Customers.xlsx.
01:52That's because we are using the Office Suite 2007.
01:57That's why that format is showing up, and the name is showing up based on the table
02:01that's selected called Customers.
02:03I am going to change the name slightly.
02:04I am going to call it CustomersSheet and I am going to change the format to a
02:08previous version of Excel, in case the people I may want to share this with
02:12don't have the latest version.
02:14So I am going to click this drop-down, change the format to Excel 97 - Excel
02:182003 just like that.
02:21Now if I wanted to, I could change the location.
02:23Right now, it's going to my Desktop but I could use the Browse button to choose
02:27another location, if I wanted to.
02:29I am happy with that location.
02:30Yours is probably going to be your Documents folder.
02:33It could be another folder depending on, if you have used this feature before
02:37and what your selection was the last time you used it.
02:39Next, we get to specify some options.
02:42Now down below you will see that only one option is available currently.
02:46If I was to export this data with the formatting and the layout, then I would
02:50also have the option down below to open the destination file after the export
02:55operation is complete.
02:56So, I am going to click that, as well as, Open the destination file when it's done.
03:01The only thing that's not available to me right now is Export only the selected
03:05records option and the reason is I didn't select records in my table.
03:09That means the entire table is going to be exported.
03:12If I wanted to select just certain records in that table, I could do that by
03:16highlighting those records and then this option would be available to me.
03:21I am going to click OK, keep in mind that it's going to launch Microsoft Excel
03:25automatically when it's done.
03:27So, I will click OK.
03:27It doesn't take long, here comes Microsoft Excel and you can see the results in here.
03:33If I maximize this screen, you can see that it looks very much like my table
03:38in Microsoft Access.
03:40Now, I could use some of the Excel Tools for analyzing and manipulating this
03:43data if I'd wanted to.
03:44Now you may have noticed down in my Task bar that Microsoft Access is flashing
03:48and that's because the wizard isn't quite complete.
03:51When I click on Microsoft Access, there is one last step here and that is the
03:54option to save the export steps that I just went through.
03:58That's handy if I do this on a regular basis, because then I can just go back to
04:02a Saved Export and just run it each time that I want, as I get new data updated
04:07into my table and so on.
04:08I am not going to do that.
04:10I am going to click Close.
04:12But I want you to see that Saved Exports then show up under the Saved Exports button.
04:17So, pretty simple stuff.
04:19I can export my data into many, many different formats including Microsoft Excel
04:24and again, the typical scenario is there are analytical Tools built into Excel
04:28that you may not have access to in Microsoft Access.
04:32So exporting your data to Excel is a very handy feature.
Collapse this transcript
11. Working with Charts
Working with charts
00:00Sometimes when you are working with data in Microsoft Access or any other
00:04application for that matter, it can be useful to get a graphical representation
00:08of the data you are looking at.
00:11For example, a common scenario in a report where you have got numbers and text
00:15thrown out on the page, it might be helpful to have a graph in there or some
00:19kind of chart showing you the big picture, making it a little bit easier to
00:23understand what you are looking at.
00:24Well, that's what we are going to do in Microsoft Access in this lesson.
00:27We are going to add a chart to one of our reports.
00:30So if you have got exercise_files, go to the Lesson_11 folder of your
00:34exercise_files and open up ChartA.
00:36And once you have opened up this database, we can go over to the Order Totals report.
00:41Now this should look familiar if you have been following along through
00:44the previous lessons.
00:45I have added a column for the Product ID since that's something we might want
00:49to use in our chart.
00:50All right, the next thing we are going to do to add the chart maybe to the
00:53bottom, or to the side of this report, would be to go to Design View.
00:57So we go up to our View drop- down and switch to Design View.
01:01And now from here, we are going to select where the chart goes.
01:04Now if we put it at the bottom, we probably want to put it in the Report footer.
01:08If we put it over to the side, we would also do that in the Report footer section.
01:13Otherwise, we end up with chart showing up next to every single record and
01:17that's not what we want.
01:18We want a grand total, the big picture.
01:21So we are going to add it to the Report footer section.
01:24And I am going to put mine at the bottom.
01:25Now it doesn't look like there is enough room there but we will make room.
01:29All we do now is go up to the Control section here on the ribbon, find this
01:33little icon that looks like a bar graph and click the Insert Chart button.
01:38Now we are going to come down here, and just click-and-drag the shape and the
01:41size of the chart that we want.
01:43I am going to go like so, a rectangular shape.
01:45Now as soon as I do the Chart Wizard starts up because I have got this Wizard
01:49button selected over here, and it's asking me which table or query would I like
01:53to use to create this chart.
01:55Well, we are looking at Orders, so I am going to use the table called Orders.
01:59Now if we had queries in there, we could select them too or select from both.
02:03I am going to use the Orders:
02:05Table, click Next which field contains the data that we want for the chart.
02:09So we are looking at the number of orders for various products.
02:12So what I would like to see are the products being ordered, the percentage of
02:16which products are getting ordered and the quantity.
02:19So I am going to choose a Product ID, and that's why I added that Product ID
02:24column and the Quantity.
02:27And I am going to click Next.
02:29This type of data that I have just selected would be ideal for a pie chart but
02:33you can see I have got all kinds of different charts and graphs to choose from.
02:37Right now, Column Chart, the very first one up here is selected, but I could go
02:40to a 3D Column Chart.
02:42And you can see there is variations of the column.
02:46Same thing going vertically and horizontally, and then we get into some area ones as well.
02:51But like I said, ideally the pie chart would work well for what we are doing in this lesson.
02:57So I am going to select this Pie Chart and click Next.
03:00Automatically, it's taken the two fields I have selected, Product ID and
03:04Quantity and kind of slotted them into the legend and the data areas of my chart.
03:10I can preview my chart at any time.
03:12I am going to click Next.
03:14And the next option is if we want the chart to change from record to record, we
03:18can select fields that link the document and the chart together.
03:21I don't want that happening, I just want the big scheme to be shown at all times.
03:25So I am going to choose no field for both the Report and the Chart fields.
03:30When I click Next, I now have an option to name my chart, Total Orders.
03:37And yes, I would like to display a legend.
03:39The legend is going to be based on the Product ID.
03:42So when I click Finish, you are going to see a representation of that down below.
03:46I am going to stretch this down a little bit, Report Footer to create some
03:50space below it as well.
03:52And this is definitely not the actual data that's showing up.
03:55To see the results, I need to go to my Report View.
03:58And I am going to do that now.
03:59All right, as we scroll down, you can see according to the size I selected,
04:07we have got our Total Orders chart showing up.
04:10It's giving me a representation of the various Product IDs 1, 2, 3, and 9.
04:15That's all I have in this particular report.
04:18Product IDs 1, 2, 3, and 9, and you can see the relationship one to the other.
04:23Now if I want to add some pizzazz to this chart, I can do that too and I can
04:27edit the chart itself.
04:28But again, I need to go back to Design View.
04:30I am going to switch to Design View here, and I am going to right-click right
04:36in the white space here in my chart and you can see I get a whole bunch of
04:40options showing up.
04:41So I can choose from the Properties that are currently showing up over here.
04:45If they are not, clicking Properties does show them.
04:47I have got Special Effects.
04:49I have got Fills, the Layout, Position, Size, Alignment, all kinds of options.
04:55The Chart Object up at the top here, if I need to edit it, I can come over to Edit.
05:01And now I am into a new design mode where I am editing the actual chart itself.
05:05So now when I right-click, you can see I can format the chart area and I
05:11am going to do that.
05:11I have got Patterns and Fonts.
05:14Right now under Border, you can see None is selected.
05:18But I am going to do an automatic one, and the color, I am going to use a nice Dark Blue.
05:23The area currently has nothing in behind as well.
05:26I could choose a nice light color if I wanted to.
05:29So I am going to go over here to a very light blue.
05:33And I am going to click OK.
05:34We will leave the Font as it is.
05:36You can see it's looking nicer already.
05:38All right, next, I am going to right-click again and notice I can change the
05:43Chart Type as well as the Chart Options.
05:45Now in the Chart Options, I have got Titles, Total Orders is what shows up there now.
05:51And if I wanted to I could change that.
05:53The Legend, I can choose to show it or not.
05:56And you can see its showing up on the right.
05:58Now Data Labels is where I can start adding some info here.
06:02For example, if I wanted the percentages showing up, that could be helpful and
06:06you can see it doesn't take any more area than needed.
06:09It shrinks down the pie and uses that extra space to throw in the
06:12percentages around the outside.
06:14I have got a Legend Key down here if I wanted to as well.
06:17So I chose the color.
06:18I have already got the color next to the pie, so I am going to deselect that.
06:22When I click OK, I am going to see those changes in my actual chart.
06:26Now I am going to click on the pie itself, and I am going to pull out this
06:29piece, kind of neat.
06:31I can separate the largest piece if I wanted to.
06:35And now, to go back to the Design View for the actual report, I just click
06:40outside the chart area and now to go see what it looks like, I can click on the
06:44Report View and just scroll down.
06:47So you can see now I have got my color, I have got my border, I have got my
06:50values, my pie pieces are separated, and they have got percentages around the outside.
06:55Using the Legend, I can see which of my products are selling the best.
07:00So that's just one way to add a chart or a graph to an existing report.
07:05You can do the same for forms as you can here for reports.
07:09In the next lesson, we will look at another type of chart called the
07:12pivot chart.
Collapse this transcript
Working with pivot charts
00:00We're going to look at another kind of chart here in Microsoft Access 2007
00:04called the PivotChart.
00:06Now the PivotChart is not really a chart.
00:08It's actually a form, but it looks a lot like a chart, when you manipulate the
00:12data that you pull from somewhere else.
00:14That can be from a table, or from a form.
00:17In this lesson, we're going to use the Customers form to create a PivotChart
00:20that gives us an idea of where our customers are located.
00:24So we can filter down by state and view by categories or cities for example.
00:29So first thing you need to do is, if you've got Exercise Files, go to the
00:33Lesson 11 folder and open up ChartB and once you've got it, we'll come over
00:38here to our Navigation Pane and click on the Customers form to display it over here on the right.
00:43So we've got a number of customers here, looks like we've got 11 of them.
00:47And each of them has their own information.
00:50We may have multiple customers in several of the states and even in some of
00:55those cities within the state.
00:56So a PivotChart will allow us to look at the big picture.
00:59So the very first thing that we need to do is go up to the Create tab in the
01:03ribbon here and choose PivotChart.
01:05Now right away, watch what happens, we get a new tab called Customers1.
01:10So it takes the Customers form that was already open, creates a duplicate
01:14Customers and adds 1 at the end, because it can't have the same name.
01:16You will notice here we've got our Data area.
01:19We've got an Axis Title on the left and the right that can be filled in and we
01:24can do a little bit more with this chart after we've got our data in there.
01:28But you'll notice that we've also got these little drop zones, where we can drop
01:31fields in from our Customers form.
01:34Now if you don't see the Field list, you may need to click this Field List
01:38button over here in the Show/Hide section of the ribbon.
01:41And then I'd like to move this into an area where it's not overlapping any of my
01:45drop zones, so I can easily drag and drop fields from this list, and this list
01:50of fields comes right from the Customers form and I can drop them into these
01:54drop zones to see the results.
01:56For example, if I want to see an overhead view of all of my customers by state,
02:00I want to be able to filter by state.
02:02Notice up here it says Drop Filter Fields Here.
02:05So if I want to filter by state, I can drag and drop that one right in here.
02:09Once it's highlighted, and I let go, I am now able to filter by State.
02:14By default All states will be showing, unless I click this drop-down and
02:18select a specific state.
02:21Save that for after.
02:22Now with the Data fields all what's going to happen is whatever field we drag in
02:26here, it's going to be counted.
02:27So we want to count the number of customers in a specific state or city.
02:32We're going to choose one of these, like First Name or Last Name.
02:34I am going to choose the Last Name field and just drop it in there.
02:37You will see it actually says Count of Last Name.
02:40It looks like altogether I've got 11 customers.
02:43But it's not broken down here into series yet, and that's where the city comes in.
02:48If we want to split this up by city now, we can drag the City field over here
02:52into the Drop Series Fields Here, drop zone and let go.
02:57And you can see that data looks a whole lot different in the background.
03:01If I hover over any of these bars I am going to get some information in this
03:04series, which is the city of Manotick.
03:06You can see I've got four.
03:09Over here I've got two and this one called Vanier and this is for all of my states.
03:14If I want to narrow it down to a specific state, I can do that by deselecting
03:18all and selecting the one state that I want, like PA.
03:21I am going to click OK.
03:23Notice how my data changes.
03:26So for the state of PA, I've got-- it looks like one in Barrhaven and over here
03:31I've got four in the city of Manotick.
03:32I am going to switch that back now to CA and PA, so I can look at two different
03:39states and get a good feel for how my customers are scattered about the states
03:44and the various cities in those states.
03:46That's what a PivotChart is all about.
03:48Being able to manipulate the data to get the view we are looking for.
03:52I am going to close up this Chart Field List.
03:55I am going to switch this back to All, click OK.
04:00And for City if I wanted to just narrow it down to specific cities I could do that too.
04:05But I am going to leave it selected as All.
04:07And if we had categories, we could also use this drop zone down below and so far
04:13we've created what's called the PivotChart with some options selected.
04:17We've tested out but we haven't saved anything yet.
04:20If I was to close this up by right clicking, I would be prompted to save it.
04:24So let's go up and save this now.
04:26We'll give it a different name other than Customers1.
04:29It's already highlighted.
04:30So I am going to call this particular one, Customers by State.
04:35Now if I wanted to I can put in brackets Pivot, just to remind me that this is a
04:40PivotChart and I'll click OK.
04:43So it shows up over here along with my Customers Form.
04:48So at any time if I want to look at it, I can come over here, see the latest,
04:53filter down if I wanted to and manipulate my data to show me exactly what it is I need to see.
05:01So play around with PivotCharts, experiment, see what happens when you move
05:06fields from one drop zone to another.
05:08Add extra fields and so on.
05:10There is a lot of fun you can have with PivotCharts and it really does give
05:14you a lot of flexibility in displaying the data you want to display, the way
05:18you want to display it.
Collapse this transcript


Suggested courses to watch next:

Access 2007 Power Shortcuts (3h 25m)
Alicia Katz Pollock

Access 2007: Queries in Depth (2h 8m)
Adam Wilbert


Access 2010 Essential Training (3h 30m)
Alicia Katz Pollock

Excel 2010 Power Shortcuts (3h 43m)
Dennis Taylor


Are you sure you want to delete this bookmark?

cancel

Bookmark this Tutorial

Name

Description

{0} characters left

Tags

Separate tags with a space. Use quotes around multi-word tags. Suggested Tags:
loading
cancel

bookmark this course

{0} characters left Separate tags with a space. Use quotes around multi-word tags. Suggested Tags:
loading

Error:

go to playlists »

Create new playlist

name:
description:
save cancel

You must be a lynda.com member to watch this video.

Every course in the lynda.com library contains free videos that let you assess the quality of our tutorials before you subscribe—just click on the blue links to watch them. Become a member to access all 104,141 instructional videos.

get started learn more

If you are already an active lynda.com member, please log in to access the lynda.com library.

Get access to all lynda.com videos

You are currently signed into your admin account, which doesn't let you view lynda.com videos. For full access to the lynda.com library, log in through iplogin.lynda.com, or sign in through your organization's portal. You may also request a user account by calling 1 1 (888) 335-9632 or emailing us at cs@lynda.com.

Get access to all lynda.com videos

You are currently signed into your admin account, which doesn't let you view lynda.com videos. For full access to the lynda.com library, log in through iplogin.lynda.com, or sign in through your organization's portal. You may also request a user account by calling 1 1 (888) 335-9632 or emailing us at cs@lynda.com.

Access to lynda.com videos

Your organization has a limited access membership to the lynda.com library that allows access to only a specific, limited selection of courses.

You don't have access to this video.

You're logged in as an account administrator, but your membership is not active.

Contact a Training Solutions Advisor at 1 (888) 335-9632.

How to access this video.

If this course is one of your five classes, then your class currently isn't in session.

If you want to watch this video and it is not part of your class, upgrade your membership for unlimited access to the full library of 2,025 courses anytime, anywhere.

learn more upgrade

You can always watch the free content included in every course.

Questions? Call Customer Service at 1 1 (888) 335-9632 or email cs@lynda.com.

You don't have access to this video.

You're logged in as an account administrator, but your membership is no longer active. You can still access reports and account information.

To reactivate your account, contact a Training Solutions Advisor at 1 1 (888) 335-9632.

Need help accessing this video?

You can't access this video from your master administrator account.

Call Customer Service at 1 1 (888) 335-9632 or email cs@lynda.com for help accessing this video.

preview image of new course page

Try our new course pages

Explore our redesigned course pages, and tell us about your experience.

If you want to switch back to the old view, change your site preferences from the my account menu.

Try the new pages No, thanks

site feedback

Thanks for signing up.

We’ll send you a confirmation email shortly.


By signing up, you’ll receive about four emails per month, including

We’ll only use your email address to send you these mailings.

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

By signing up, you’ll receive about four emails per month, including

We’ll only use your email address to send you these mailings.

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked