navigate site menu

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

Access 2007: Forms and Reports in Depth

Access 2007: Forms and Reports in Depth

with Adam Wilbert

 


Discover how to manage data entry and reporting tasks more efficiently with Access 2007. Author Adam Wilbert presents lessons designing forms, organizing and displaying data with form controls, creating flexible queries, and building a form-based navigation system. The course also shows how to build reports from wizards and queries, highlight important data with conditional formatting, and automate reporting processes with macros.
Topics include:
  • Designing for the end user
  • Organizing form elements
  • Formatting a form
  • Adding headers
  • Linking to external content
  • Entering and selecting data
  • Adding charts
  • Creating a main menu
  • Creating a customer form
  • Understanding report structure
  • Building reports from wizards and queries
  • Printing reports

show more

author
Adam Wilbert
subject
Business, Forms, Databases
software
Access 2007, Office 2007
level
Intermediate
duration
3h 37m
released
Feb 14, 2012

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:04Hello! I am Adam Wilbert, and I'd like to welcome you to Access 2007: Forms And Reports In Depth.
00:10In this course, we are going to explore the inner workings of two highly
00:13configurable objects inside of an Access database.
00:16With Forms, I will show you how to create easy-to-use data entry points that
00:20interface with your data tables.
00:21We will work with controls and layout and design views,
00:24as well as explore Access's extensive Property Sheets, where we can fine-tune
00:28their behavior, appearance and interactivity.
00:31Reports use many of the same tools and techniques as Forms and are great for
00:35preparing data for the printed page.
00:37With reports, we'll look at grouping data into categories, while leveraging
00:41header and footer sections to organize your report structure and make them easy to read.
00:45We will build reports from scratch that are tied to query record sources for
00:49increased flexibility, and we'll hook them all back into a form-based navigation
00:53system to help end users move around the database and accomplish tasks without
00:57having to know anything about its inner structure.
00:59Thank you for joining me.
01:00Now let's dig into Access 2007: Forms and Reports In Depth.
Collapse this transcript
Using the exercise files
00:00If you have access to the Exercise Files for this course, you can put them on
00:03your Desktop, as I have done here, or anywhere else that you want.
00:07Here are the files that we will be using.
00:09I have organized them into folders for each chapter.
00:11And inside the folder, it's a database for each movie.
00:14Now for some movies, I have saved a completed version of the database for your review.
00:18If you don't have access to the Exercise Files, you can follow along with
00:21your own database.
Collapse this transcript
1. Introduction to Forms
Introducing forms
00:00One of the things that I really like about Access is that it's not just a
00:03place to store data.
00:05Yeah, we talk a lot about data and records and relationships and queries, but
00:09where Access truly shines is in its ability to create a fully customized
00:12application that is uniquely tailored to your specific needs.
00:16Where this really becomes apparent is when we start to digging into Forms.
00:20Forms are all about user interface.
00:22They provide the mechanisms that translate what you want to get done to the
00:26inner workings of the database.
00:27In fact, in a well-designed Access database, there may never be a need to
00:32actually even see a data table, or a query, or a relationships map.
00:36Those are all background processes that organize input and output, and once
00:40they're set up properly should just work with little maintenance.
00:44Forms handle all of the grunt work of capturing user intent and moving
00:47it through the system.
00:49They help guide users through the available options.
00:51I'm going to go ahead and open up the completed file from this course.
00:54This 1-1 TwoTreesCompleted.
00:58I will double-click on it to open it in Access
01:01and we will see a couple of things happen.
01:02First, we have a splash screen that tells the end-user what's going on, that we're loading the Two Trees Olive Oil Company database.
01:09The next thing I see is a Main Menu screen, and here it presents me with a lot
01:12of options that I can do within the database.
01:14For instance, I can View the Employee Directory.
01:18If I click on this button here, it takes me to the Employee Directory for the company.
01:21I can scroll through the list to see all of our employees, or I can return to
01:26the Main Menu using this button here.
01:29Going down the list I can enter a Product Review.
01:31If I click this button, I get a window showing me reviews for the products.
01:36I can return to the Main Menu and Add a new customer to my database by
01:40clicking this button.
01:42The Add a new customer form opens, allows me to type in the values and Save that
01:46Customer, or decide I don't want to do this and Cancel out.
01:49I will go ahead and say Cancel Entry.
01:51I can also Export Customers to an Excel file or email a report to an employee.
01:56I also have options to Exit this Database, here.
02:00So knowing nothing about this database going into it, we can accomplish some
02:04very specific tasks without even digging into the navigation system.
02:07If you think about Word as a tool for creating documents, then Access is really
02:11a tool for creating more specific tools.
02:13I know that's kind of an abstract idea, so let me explain.
02:17You can use Access and have a fully operational database with nothing more than
02:21a few tables and queries.
02:22And in fact, that's where a lot of other database programs end.
02:26But when you layer Forms and Reports on top of that data, you start
02:29creating something more.
02:30It becomes a custom application where Access, the program, doesn't really matter anymore.
02:35You have created a custom tool that operates within Access, but it's tailored to
02:38your specific needs, because in the end, unlike with Word, the database file
02:43really isn't the end goal.
02:45The end goal is to have a place to store data, to retrieve records easily, and to
02:49manage the day-to-day operations of the organization.
02:52Your job as a database designer is to create the tool.
Collapse this transcript
Designing for the end user
00:00Throughout this title, I will often refer to the database's end-user.
00:04And I wanted you to take a moment to define who I think this person is and why
00:08they are important to keep at the front of your mind while designing your Forms and Reports.
00:12The end-user isn't anyone specific.
00:14They are more of a theoretical individual that is completely new to your organization.
00:19They may be a new hire or an intern or maybe even your grandmother. Somebody
00:23that knows very little about your day- to-day tasks and even less about how to
00:27use Microsoft Access.
00:29As you develop your database application, occasionally put yourself in their
00:32position and look at your workflow as if you are brand-new to it.
00:36If you can set up your navigation and data entry and reporting systems tailored
00:40to the end-user, that uninitiated, first- day-on-the-job employee, then you will
00:45be well on your way towards creating a successful application.
Collapse this transcript
Exploring the database
00:00One of the main ideas behind creating Forms and Reports is to allow your
00:04end-users to be able to work with the database without knowing a whole lot
00:07about its structure.
00:08You as a database designer, on the other hand, need to have some familiarity with
00:12the data tables within the database in order to be able to work with them.
00:15Let's take a look at the Two Trees Olive Oil company database that we will be
00:18working with throughout this course.
00:21In my navigation pane on the left, I've got all of the data tables we'll be working with.
00:24I have got a table for Orders, a table for Customers, Employees, Products, and so on.
00:31Let's go ahead and double-click on the Orders table and take a look at what's inside.
00:35And within the Orders table, I have got fields for the Order ID, the Order Date,
00:40Customer ID, Product ID, and Salesperson ID.
00:44Now all these ID numbers reference other fields and other data tables.
00:47So for instance, Customer ID here is linked to Direct Customers table and if I
00:53open up that, I can find the customer that was associated with the order by
00:58referring to their Customer ID number here.
01:01And all the data tables within our database are related to each other.
01:03I can see how they are related by going up to Database Tools and Relationships.
01:09Here I can see that the Orders table and the customer ID within is linked to the
01:14Direct Customers table and the Customer ID.
01:17So by using these two tables together, I can find the order that was placed and
01:21the name of the person who placed that order.
01:23The same thing applies to the Employees table;
01:25I can find the salesperson who assisted with the order.
01:28Both of these tables, the Employees table and the Direct Customers table, are
01:33linked to a lookup table of States, where we match an abbreviated state to the
01:37full state name, and we can find out additional information about what division
01:41and region that state is in.
01:42Now take a look at our Product ID number in the Orders table; I can use that as
01:47a reference to look up the products in our Product Table.
01:51So from the Product ID, I can find the product name.
01:54And once I know the product name, I could find out what size it is, for instance,
01:59or what type of oil it used.
02:01So these are the data tables we'll be working with as we create our Forms and
02:04Reports throughout the rest of this course.
Collapse this transcript
Creating a form with the wizard
00:00You can have a basic form up and running with as little as three clicks of the mouse.
00:05For instance, I can go to this Orders table, click on it once, go to the Create
00:10tab and in the Form section, click on Form.
00:15Access will open up a new form based off of the Orders table and will place it in Layout view.
00:20Let's change our View to Form View so we can work with that data.
00:24From the Views button on the left, I will go ahead and click this button, and it
00:27will switch us into Form View.
00:30Now this is a live link to our data within the Orders table.
00:33I can see that I have 2,200 records, and this first record here is order number 10,000.
00:38If I open up my Orders table here-- double-click on it to open--we will see the
00:43record number one is indeed order 10,000.
00:45Now these are live linked to our data table. I can go ahead and make changes here
00:50within the form. For instance, if I click on this OrderDate 1/10/2005, and using
00:55the calendar picker on the right, I can change this date. Let's say it's the 6th.
00:58I will click on the pencil icon here to commit that change to the table, and now
01:05in my Orders table, I can see that that change has been made.
01:08This works the other way as well.
01:09I can click on the OrderDate, click on the Calendar icon, and change it back to the 10th.
01:14I will select the pencil icon again to commit that change and return to the
01:20form, where I can see that the date is back to where it was.
01:24I like to think of these little squares as windows into the data table cells.
01:27So this is a little window here into the OrderID of the Orders table, and this one
01:32is the window into the OrderDate for the Orders table.
01:35Now the basic form that Access created for us leaves a little bit to be desired.
01:40For instance, it's only built on the fields that are within the Order table.
01:44I got a CustomerID here, but I don't know who this customer is.
01:48The same way, I have got the ProductID, but I don't know what product this refers to.
01:53I can create a better form using the FormWizard that will give us that
01:56information from the related data tables.
01:58Let me go ahead and close both of these, and I don't need to save any changes,
02:02so close, and I will say No to save changes, and I will close my data table.
02:08Now I will use the wizard, and we can find that by using the Create tab, More
02:12Forms, and then Form Wizard.
02:14And we will create a form based off of multiple related tables.
02:18I am going to choose my Orders table from the list here, and I'll use the
02:23OrderID and OrderDate.
02:25But instead of CustomerID, I am going to pull that from the Direct Customers table.
02:30So I'll go back up to my Tables and Queries selection, select the Direct Customers
02:34table, and pull in the FirstName and LastName.
02:38I will return to the drop-down menu, select my Products table, and from there I
02:44can get the ProductName, and I will add that to my form.
02:47Now that I have got all the fields for my data tables selected, I will go ahead
02:51and say Next, and Access is going to ask us how we want our form to lay out.
02:57This first option, by table Orders, as a Single form, is similar to the form that
03:02Access created for us just a moment ago.
03:04It will display each record in its own page.
03:06Let's go ahead and say Next, and we will accept this default column. We will
03:12accept the default style, this Access 2007, and say Next.
03:16And I will go ahead and accept the default name, and then say Finish.
03:19Now Access gives us a form that's similar to the first one, except that it's
03:25giving us the name, First and Last Name, and the Product Name of the oil that
03:29was ordered, instead of just the reference ID numbers.
03:31Let's go ahead and use the Wizard again to select a couple of different
03:34options, and see how we can improve upon this.
03:37Go to the Create tab > More Forms, and Form Wizard.
03:41We will build another form using the same options;
03:46Select my Orders table, OrderID, and Date.
03:48I will select my Direct Customers table, First and Last Name, and I will select
03:56my Products table, ProductName. Go ahead and say Next.
04:02This time, let's view it by the table Products.
04:05When I click on by tbl_Products, Access shows me a little image here what
04:09it's going to look like, and it's showing me that it's going to be a Form with subforms.
04:13So we are going to have a Product Name here at the top, and then we have a list
04:17of all the orders that included that product.
04:19We will look at Linked forms in just a moment.
04:22Go ahead and say Next, we will accept the defaults here, and again, and we will
04:27accept the default name. Go and say Finish.
04:29Now I have got a form that's set up, and I can scroll through the records here
04:34and select different oil, so I have got 90 products within my database.
04:38I can select an order here on the bottom, and it will show mw all of the orders
04:42for that particular oil.
04:44Let's go ahead and close this out and I will show you this last option that
04:46we want to work with.
04:47I will close those two tabs, and I am actually going to delete them from my
04:51Navigation Pane here.
04:52So I will select the last one and Shift+Click to select the first one,
04:57right-click and Delete.
04:59And yes, we will go ahead and delete this.
05:00Let's run through the Wizard one more time and look at that Linked forms options.
05:04Let's click Create > More Forms> Form Wizard.
05:09Once again, we will pull in the same fields, so Orders table: OrderID, and
05:13OrderDate. The Direct Customers table: First and Last Name. And the
05:20Products table: ProductName.
05:23Go ahead and say Next.
05:26This time we'll choose to view by the table products, but instead of Form with
05:29subforms, we will choose Linked forms.
05:32This will create two separate forms that show me the same information.
05:35I will go ahead and say Next.
05:37We will accept the defaults here, and this time I'm going to go ahead and name
05:41these, since I want to work with them in the next movie.
05:44So this First form I am going to call ProductSelection, and the Second form I am
05:48going to call OrdersByProduct.
05:49We will go ahead and say Finish.
05:54And Access opens up the First form.
05:56Now there is a little bit of a bug in the way Access creates this form.
05:59It's got a button here, but I can't click on the button, because this label
06:02gets put on top of it.
06:04So in order to fix that, we are going to switch into Layout View real quick so
06:07we can rearrange this a little bit, and we will look at Layout View in depth in
06:10the next movie. But for now, go ahead and just click the View button to switch to Layout View.
06:15And I will click and drag this label to the right a little, and that will free
06:20up my button, so I can click and drag that to the right, and I then I will move
06:23the label back to where it was.
06:24Okay, press the form view button to switch back to form view.
06:28Now I have got a form here where I can scroll through my different oils. Once
06:34I find one that I want to investigate, this Extra Virgin Oil 8 oz size which
06:38is product 6 of 90,
06:39I can click my OrdersByProduct button.
06:42That will open up a second form that will list all of the orders that included
06:47that particular product.
06:49So using the Wizard, we were able to create three slightly different user
06:52experiences, and using data from multiple related tables, we were able to get
06:56details on order activity at Two Trees.
06:59As is typical with the objects created with the Wizard, we have a good starting
07:02point, but we need to clean this up a bit before it's presentable.
07:05Let's take a look at the Layout View in the next movie to finish these forms.
Collapse this transcript
Refining the form in Layout view
00:00The Form Wizard gave us a good head start on setting up a couple of forms that
00:04will allow us to select a product and get a listing of all the orders that
00:08included that product.
00:10Now we need to polish up the layout a little using the tools available to us
00:13in the Layout View.
00:14Let's take a look at what we want to change before we go into Layout View.
00:18Now, the ProductSelection form is pretty basic.
00:22I want to change some of the colors a little bit to make it in line with our Two
00:25Trees company colors.
00:26I also want to remove the box around this field here.
00:30It doesn't really add anything to the form.
00:31But other than that, there's not a whole lot here to change.
00:35The other form, OrdersByProduct, has a lot of changes I want to make.
00:38For instance, this blue color is not really doing much for me.
00:41I also want to change this up a little bit.
00:44It's got a lot of space between each record,
00:46so I want to condense this down to fit more on each screen.
00:49I also want to change the headers up here.
00:51Right now they're coming from the form fields in the Orders table, and I'm going
00:54to go ahead and insert spaces in these to make them a little more legible.
00:57So we're going to go into the Layout View and we'll make these changes.
01:00Let's go to the ProductSelection form.
01:03We'll switch to Layout View by going to the View menu and clicking this button here.
01:07That'll move us into Layout View.
01:09If the Field List pops open, we can go ahead and just close it down;
01:11we won't use that in this movie.
01:13Now, let's look at the tabs that are available to us in Layout View.
01:17I've got the Format Tab selected right now and on the Format Tab, we have
01:20options for changing the Font--for instance, the Font Face and Size, whether
01:25it's Bold, Italicized, or Underlined, its layout--if it's Left, Center, or
01:30Right-Justified, Color.
01:32I can also have an option for conditional formatting and we'll talk about
01:35Conditional formatting later on in the course.
01:36There's a section here called Formatting, and the Formatting section applies to
01:41numerical fields like dates and times.
01:43We can specify whether they're currency, or percent, or where the decimals fall.
01:47Gridlines will apply to the records, so we can put grids around each record
01:51as it appears in the form.
01:52This Controls section has elements for Title, Date, and Time. We can adjust that
01:57Line Type that appears around things, such as this line right here.
02:00Then we've got a section called AutoFormat that has a couple of galleries, and we
02:05can select some predefined styles.
02:07The AutoFormat galleries, it's a scrolling list here, or we can click this
02:10button, the Downward-Pointing Arrow, to see the full list of galleries. And we
02:14can go through and select different ones to see different color options for our form.
02:17For instance, I'll click on this Northwind one here, and it'll change it to an
02:20orange and stripes format, or I can select one called None here, and I like
02:26the None one because it removes all the formatting.
02:29It gives me a blank slate, creates a white background, black text. And I
02:33like to use this as a good starting point when I want to customize my forms.
02:36So I'm going to select None from the AutoFormat gallery and then we'll go ahead
02:39and change some of the colors.
02:40I'm going to select the top of our form here and that'll highlight and
02:45I'll change the color of this to Green 4 by going to this Paint Bucket
02:49icon and selecting Green 4.
02:50I'll also remove the line that appears around our oil name by selecting that
02:56field, going to the Controls section, and changing Line Type to this Transparent
03:01option that appears at the top.
03:03And incidentally, that's exactly the same as going to Line Color and Transparent.
03:07So either of other those options will do the same thing.
03:09That will remove the line around my oil name and that will clean it up quite a bit.
03:14So that's all I really want to change on this form.
03:16Let's go ahead and switch to the OrdersByProduct form.
03:20This one, I'll do the same thing.
03:21I'll switch into Layout View by clicking the View menu up here in the left.
03:24And I'm going to start with a clean slate.
03:27So I'll go to AutoFormat and choose the None option.
03:31We'll change our header color to the same, green, so I'll click on the header,
03:35click on the Paint Bucket which is already filled with that green paint, or I
03:40can go ahead and click the Down button and select Green 4 again.
03:42I want to change these rows here so that they alternate color, and I can
03:48click on one of the rows over here on the right and we'll select that entire row
03:51and that's actually selecting the background for each record.
03:55And here on the Font section, even though this isn't really a font option, but
03:59that's where the button is...
04:00So in the Font group, I've got this button here for Alternating Color, and I can
04:04select maybe Green 2.
04:06That will give it a light green color every other row.
04:09Let's go ahead and clean these up a little.
04:12We want to shrink these so that I can fit more on a page.
04:16Select from one of the fields here. For instance under this Last Name, I'll click
04:19Oneil, and from there, I can drag on the bottom to move this up a little.
04:24That'll tighten up the display.
04:25I also want to remove the boxes around each name.
04:28Access likes to put boxes around everything, and it really just adds to the
04:31visual clutter, so it doesn't really add anything to the legibility of my form.
04:35So I'm going to go ahead and select all of these at once by Shift+clicking and
04:38then click across, so FirstName, OrderDate, and the OrderID.
04:42And I'll remove the lines from all of these by going to the Controls section, Line
04:47Type, and then None.
04:48I can also click Line Color and Transparent. I'm going to select the Record Selector over here on the left to deselect everything else
04:55so I can see how we're looking so far.
04:58It's looking pretty good.
05:00One other thing I want to do is change some of the spacing that I have here in my columns.
05:05I want to take Date and give it a little more space and maybe reduce the space
05:09that FirstName is taking.
05:11So I'll click on this FirstName field and when I do that, I notice, just like
05:15with that Product Selection form from the last movie, that the label is actually
05:19taking up all the space here.
05:20It's actually covering up these other three.
05:22So I need to make that a little smaller so I can grab the objects that are underneath.
05:25Now I can click on FirstName and I can make this column a little bit narrower.
05:30I can click on OrderDate and I'll drag on the right to make that a little wider.
05:36I can also center these so that they appear centered in the column.
05:38I'll press the Center Alignment button and I'll do the same for the data below.
05:44Click on the data and Center Align.
05:46Now, since Date is a numeric field, the Formatting options have appeared and I
05:52can change the way that my dates are formatted.
05:54From the drop-down menu, I can select, for instance, Medium Date and that'll
05:58change how the dates are displayed.
05:59Now the last thing I want to do is change the titles for the row headers, and
06:04I'll double-click on those to activate them.
06:06Then I'll just click my mouse where I want them to have a space in here.
06:09So I'll double-click on OrderDate, add a space, double-click on FirstName, add a
06:13space, and double-click on LastName, and I'll move my cursor and add a space.
06:19So, there's my form, and let's go ahead and close these, and we'll save the
06:23changes, and we'll look at how our workflow is shaping up.
06:25I'll close this form.
06:27I'll save the changes, and I'll close the ProductSelection form and save those changes.
06:33Now when I want to review my OrdersByProduct, I'll open up my ProductSelection
06:37form, I can scroll to the product that I'm interested in.
06:40For instance, I'll stop on record 7, this Extra Virgin Oil, 16 ounces, and
06:45say OrdersByProduct.
06:46Then it opens up the OrdersByProduct form and it shows me all of the orders that
06:52included that particular product.
06:54The Layout View gives you some easy-to- use tools for organizing the flow of your
06:57forms and making sure that everything is aligned.
07:01For even more flexibility, we'll dive into the full design environment, and we'll
07:04take a look at that in the next chapter.
Collapse this transcript
2. Form Design Basics: Creating a Directory
Organizing the form elements
00:00Combining the Form Wizard and Layout View are easy ways to get started creating
00:05your database's forms.
00:06But the real power and flexibility lies in utilizing the full design environment
00:11for creating forms from scratch.
00:13Once you understand what's going on under the hood, creating your own forms that
00:17meet your exact specifications and needs will become second nature.
00:20Let's start by creating a Rolodex style Employee Directory for Two Trees.
00:24Now I have got a completed example here in my database called
00:28frm_Employees-Complete. I will double click on that to open.
00:32Now this is an example of what we might be shooting for.
00:35Now, because some of the design decisions that we are going to make while
00:38creating our form are going to be a little bit subjective, our finished form
00:42might be a little bit different than this one, but this is the idea of what we are shooting for.
00:46We are going to have a scrollable form that will show all of our employees
00:50within the company, we will have their photo and their name and some details
00:53about the employment.
00:54And it will have this header at the top with a title, and that part doesn't
00:57scroll as we move through the records.
01:00And it's got a couple of design elements such as the shaded background on every
01:03other record and some playful fonts here for the employee ID number and the
01:07state that they are in.
01:09So let's see how we can duplicate this using the Design view.
01:12I will go ahead and close this format and we will start a new one by going to
01:16Create and then Form Design in the Forms group.
01:19This will open up a blank form in Design view and I can see that I have got this
01:23grid here in the background with these dots in the gridlines.
01:26And this is an alignment grid; this will help us organize our elements within
01:29the form and make sure everything is lined up.
01:31So these dots aren't going to show on the final form.
01:34Now when I start a new form in Design view, the first thing I needed to do is
01:38link this form to the particular table that the data will be pulled from.
01:42Now with that open, you can open up the field list by going to Design ribbon
01:47and clicking on Add Existing Fields.
01:48That will open up this Fields List here and from it we can see a list of all the
01:53tables within our database, and if I open these up by pressing the plus
01:56button, we'll see all the fields within each table.
01:59Let's go ahead and open up my Employees table, tbl_Employees.
02:05And I will find the FirstName field and I will double-click on that to add that to my form.
02:11Now when I do that, a couple of things happen. First I get a FirstName field
02:15here put into my form.
02:17And now that I have also told my form that the data will be becoming from
02:21the Employees table, it changes the field list a little bit to show me some
02:25related tables and the fields that are within those tables that are related
02:29to my Employees table.
02:31Over here on my form, I have got these two objects that appear.
02:34This one here on the right with the white background is the text box and that's
02:39where the data will show up as I scroll through the records.
02:42The one on the left is a label, and every object that you add to your form will come with a label.
02:48The label is a static piece of text that just tells the end-user what appears to the right.
02:52If I switch into Form view at this point by clicking up on the View
02:55button, this Form button,
02:57I can see that the label still reads FirstName, whereas the text box changed to the
03:01data for the first record.
03:02If I scroll through the records down here on the bottom, I could see the first
03:06name of each of my employees.
03:07Let's go back into Design view by clicking View > Design View.
03:13Let's add the other fields to our form and then we'll move them around and
03:16arrange them into position.
03:17From the Field list, I will double- click on LastName, Phone number, Address,
03:24City, State, Zip, Email, HireDate.
03:30I don't want everybody's hourly pay showing up, so I will skip that one.
03:33We will do Department, Photo, and then back at top, the Employee ID number.
03:39Now I have got all of these listed on my form, some of them are overlapping a
03:43little bit, like the LastName appeared right on top of first name. If
03:46I click on it I can drag it by using this orange handle around the edges. So I
03:51will click and once I get the double headed arrow, I can drag off of it.
03:54So now they are separated.
03:56Now when you move an object the label comes with it.
04:00So for instance, when I just move that LastName box, the label for LastName moved with it.
04:04If I drag on the object around the edge right anywhere where I can see the
04:08crossed arrow, that'll move both the label and the object at the same time.
04:13So for instance, if I grab here, click and drag, that will move the text box and the label with it.
04:19If I use the handle in the upper left- hand corner, I get the same icon, but I can
04:24move the objects independently of each other.
04:25So for instance, I could take this last name and drag it using the handle on the
04:30upper left corner and put it below the label, and it moves it like that.
04:35Now if I drag using the orange box around the edge it maintains that new special
04:39relationship between the text box and the label.
04:42The other handles around the edge will allow you to resize, so I could drag it
04:46to the left, drag it down to the left, make it taller, make it wider.
04:50So let's go ahead and arrange these onto our form, and we are going to move the
04:55objects around and put them into position.
04:58Now some of the labels might be a little bit redundant. For instance, the data
05:02that appears in First and Last Name, I am going to be able to understand that
05:05that's the first and last name for my employee; I don't need a label that says
05:08this is the first name, this is the last name.
05:11So I can get rid of some of these redundant labels.
05:12I am going to get rid of the FirstName label by clicking on it and pressing
05:16Delete. LastName, click on that label and press Delete.
05:20I also want to get rid of some of these that are associated with the address.
05:25I can leave one that says address, but for City, State, and Zip, I am going to
05:29have all of these boxes grouped together. The end users, I think, will understand
05:32that Address, City, State, and Zip all are part of the address.
05:35I don't need a label that says now this is the City, now this is the State, now
05:39this is the ZipCode.
05:41So we will get rid of these three.
05:42I can select multiple objects by Shift+ clicking, so I will press Shift and click
05:47on the other two for City, State, and Zip, and I'll press the Delete button to get
05:51rid of those labels.
05:52Photo is the same way, I don't need a label to tell me that this is a picture.
05:55I will click on the Photo label and press Delete.
05:59Let's start moving these into position.
06:00I will drag my FirstName box and I am going to put it up here just to the right
06:06of the two inch marker. I will take LastName and drag it and put it to the right of that.
06:11I am going to move Phone number below FirstName.
06:18And I am also going to take the Email address and put that below Phone number.
06:21So click on Email, drag that up.
06:24Below that, I am going to display the address. We will click on Address and I will
06:29move that over. Below Address, I can put City, State, and Zip all in one line.
06:34So City, I will drag that and put it in position.
06:39State, I am going to drag that to the right of City. And Zip, I will put to
06:43the right of State.
06:44HireDate and Department, I will go ahead and put it below the address, and maybe I'll
06:52put Department over here to he right.
06:53I can also use the Arrow keys to move things around, so I can nudge the
06:57objects on the form by pressing the Down key and the Right key to move
07:01things into position.
07:02Let's go ahead and move these labels over. So that I have a little bit of room,
07:06I want to put the photo over here on the left side.
07:08So I want to move these labels for Phone number, Email, Address, and HireDate
07:12out of the way a little bit.
07:13I will go ahead and click on HireDate one and using the brown handle to move it
07:17independently of the HireDate text box, I will scroll that over a little.
07:23And once it's in position, I can actually use its position align the other objects.
07:27So if I drag a box around all four of these, I can go up to the Arrange tab
07:33and click on this Right button and that will align all of the objects to the rightmost object.
07:37And so they all line up.
07:39Now I have got room for my photo, I will click on the Photo box, drag that up,
07:45and I can make it a little bit bigger.
07:46Now I have got something special in mind for the Employee ID number. What I would like
07:51is for that to display on top of the photo, kind of like a little transparent
07:54box or an ID tag that you might see on a badge or something.
07:57So I am going to get rid of this label, I will click on the EmpID label on the
08:02left, and press Delete.
08:03And I will drag the EmpID number field and I will drag that, and I am actually
08:07going to put it over the Photo box.
08:10So you can see the Photo box here in the background.
08:12Now because I have related tables here, I am pulling in information from my
08:15employees data table, I can relate other data tables within my database.
08:19For instance, I have got a two letter state abbreviation stored with each employee.
08:23And from that, in my States lookup table I can grab the full StateName.
08:28So I am going to take this, in the fields available in related tables section of
08:32my Field List, and I am going to double-click on StateName to add that to my
08:37form. Get rid of the label, and I will move that up.
08:41Now I am going to have a little bit of fun with the StateName label in the next
08:44movie, but we can finesse these positions as we continue to develop our form and
08:49truth be told, form design is going to require a lot of back-and-forth as the
08:53final layout gets further refined.
08:54Let's take a look at where we are at this point.
08:56I am going to go back to the Design tab and click the View button, and switch
09:01back into Form view.
09:03Incidentally, I could also to go the Home tab and find same button there.
09:06I'll switch back into Form view and we will see my form there with elements in
09:10position. Not all of my employees have photos associated with them, so I can
09:14scroll through until I find one, say record number six for Nicholas Bond,
09:18has a photo attached.
09:20One thing before I leave here that you can notice is that some of these boxes need
09:23to be a little bigger. Address for example, Email address need to be a little
09:28bit bigger. Same with Department ID.
09:31So we are going to make these a little bit bigger. Switch back into Design view real
09:34quick, by clicking the View down button > Design View.
09:39And we will make Address wider by clicking on it and dragging to the right, and
09:43 make Email wider by dragging to the right
09:47And I will make Department wider. I drag this to the left, I have room there, and we
09:53will see how that looks.
09:54Switch back to Form view, and now everything is looking like it's fitting
09:58in its box properly.
09:59Now that we have our Form field elements in roughly the positions that we want
10:02them, we could take a look at some of the formatting options that are available to us.
10:06We will pick it up there in the next movie.
Collapse this transcript
Formatting the form
00:00In the last movie we looked at how we can add references to our data tables
00:03using the Field List and how we can arrange fields within our form.
00:08Now let's turn our attention to formatting.
00:10The Design tab has many of the common formatting options that you might
00:14recognize from other programs such as Word or Excel.
00:16We are going to continue working with the Employee Directory.
00:19I have gone ahead and saved it with the name Employee Directory, and we will
00:22switch into Design view.
00:25On the Design tab of the Ribbon, we have got all of our Formatting options.
00:30Let's go ahead and format our objects, and we can start with this first name field.
00:34I am going to click on FirstName to select it and we will take a look at our Font options.
00:39First, I want our first and last name to stand out from the rest of the data.
00:44I am going to go ahead and change its font size a little bit from 11 up to 14.
00:48I am also going to make it bold, so I will click on this B icon to make it bold.
00:55Now, I can apply the formatting that I've chosen for my FirstName field to the
00:59LastName field by using this paintbrush icon called the Format Painter.
01:03I will click on the paintbrush and then I will click on the LastName field to
01:07apply the same formatting from FirstName to LastName.
01:09I want to take the labels here for Phone number, Email, Address, HireDate and
01:15Department and I want to actually make that a little bit lighter gray. I don't
01:19want those to stand out and confuse with the data a little bit.
01:22So we are going to reduce those in the visual hierarchy on the screen by
01:26turning those to a gray color instead of black.
01:28I will click on the Department label, and I will Shift+Click and click HireDate,
01:33Address, Email, and Phone number to change their properties all at once.
01:39For them, I am going to change the Font color using this button up here on the
01:42top; it's got this A with a red bar underneath it.
01:44I will use the drop-down menu and I'll choose this one here, Light Gray 5.
01:51Now I want to go ahead and remove the boxes from around all my form fields.
01:56If I go back into Form view to take a look at that, you will see that we have
01:59boxes around everything and it actually really adds a lot of clutter to our form.
02:03So I want to get rid of those boxes.
02:06Go back into Design view by clicking the View button > Design view.
02:09And we can select every object on our form all at once by using this button here
02:13in the Control section of the Design ribbon called Select All, or you can use
02:17the keyboard shortcut Ctrl+A. So select everything on our form and we will
02:22change the Line style to Transparent.
02:26Again, you can also use the Line color as transparent and that will do the same thing.
02:31Now all my boxes are gone, or at least... they not gone; they are just invisible.
02:36I go ahead and play with the fonts for Employee ID number and StateName.
02:39For EmpID, I want that to appear on top of the photo, so I don't want a white box
02:44appearing behind it.
02:45I am going to change its background color here to Transparent.
02:50I also want to make it big and bold so it stands on top of every photo.
02:55I am going to change its font to Impact by clicking the Font down button and
03:00scrolling through my list until I find Impact.
03:03I am going to move it to the right side of the field by clicking the Right Align button.
03:10And I am going to change its color to a dark gray.
03:12I will go to the Font Color and I am going to choose Dark Gray 3.
03:17Now I am going to apply the same formatting to the StateName field over here.
03:22Again, I will use the Format Painter to that.
03:24I will click on the paintbrush and click on StateName.
03:27Now the StateName, I am going to have a little bit of fun with this in my
03:30report. I am going to make this really big and just use it as a graphical
03:33element behind everything else.
03:35I am going to drag its box and make it really big here.
03:39I am going to move it and put it right up against the edge of my form.
03:43In fact, I am actually going to make my form a little bit wider and I can do
03:46that by clicking on this edge here and dragging out to about the 8-inch mark.
03:50I will move StateName all the way over to that edge and
03:54I am going to move it up.
03:55Now I am going to make it a little bit taller.
03:59And I am going to change its font size to something really big, like 48.
04:03Now the whole StateName is not going to fit in this box; it's only going to show the
04:06top of the StateName, but again, we are just having fun with this. It's going to
04:10be a little visual element, and I will make this little bit bigger.
04:14And now I want it to appear behind everything else.
04:16So let me go to the Arrange tab and put Sent to Back and that will put it behind
04:22all these other fields.
04:23Let's take a look at how our form is looking.
04:26I can go to the Home tab, switch into Form View or again, I can go to Design tab
04:32and switch it to Form View; either one will do the same thing.
04:34And we will take a look at how this is working.
04:37Let's scroll to one that has a photo attached. I am going to scroll to Record
04:40Number 6, and we can see Nicholas Bond. Here is his ID number appearing on top of the photo.
04:45I've got the State Name appearing big and bold in the background and taking a
04:50look at this, I can see couple of other things that I might want to change here.
04:53For instance, numbers tend to appear to the right of their form fields.
04:58So the Zip code is appearing all the way on the right side. Hire Date,
05:02appearing on the right side.
05:04Also I want to adjust my font a little bit for this Employee ID number and maybe make
05:07the State Name a little bit lighter so it recedes into the background.
05:11Go back to the Form View to make those changes. Go to View > Design View. First,
05:17let's change the alignment of the Hire Date and Zip Code boxes. I will click on
05:20HireDate, Shift+Click on Zip, and then force those to be left aligned.
05:27Nothing really changes on the screen here, but it will change when we view it in Form View.
05:30EmpID--I am going to make that little bit bigger, change its font, how about
05:3624. And both of these, I think, were a little bit dark. I am gong to make them a
05:41little bit lighter.
05:42So EmpID, I am going to Shift+Click on StateName here. I am going to change
05:46that color. How about the medium gray one? That should stand out a little bit
05:51better on the photo.
05:52Let's go into Form view. We'll scroll to record number 6, and we can see the number
05:58appearing on top of the photo.
06:00The Design tab puts many common controls right up front in the ribbon.
06:03Changing fonts and colors and line styles here can be really quick, especially
06:07if you make good use of the Format Painter tool.
06:08But for some serious control over every aspect of your form, we are going to
06:13need to dig a little bit deeper and explore the Property Sheet, and we will do
06:17that in the next movie.
Collapse this transcript
Modifying the form through its properties
00:00The Design tab on the Ribbon gives you a quick place to change some of the most
00:03common settings for your form elements such as Font Color and Font Size.
00:08But those options are only the tip of the iceberg when it comes to the vast
00:11number of properties that each element possesses.
00:14To see the full list, we'll have to dive into the Property Sheet for our form.
00:18And we can do that by switching into Design View in the Ribbon. I'll click the
00:21View Down button, and then Design View.
00:23Now I can open the Property Sheet by going to the Design tab and clicking the
00:28Property Sheet button, way over here on the right side.
00:31I could also use a couple of shortcut keys.
00:33I could press Alt+Enter, which will toggle the Property Sheet on and off, or I
00:38can press the F4 key.
00:39And the F4 key will also toggle it on or off.
00:43So however you'd like to do it, go ahead and turn on the Property Sheet.
00:45Now as I click around the objects on my form--for instance, I'll click on
00:49this FirstName field here--we'll notice that it jumps to the properties for FirstName.
00:53If I click on LastName, it moves to the properties for LastName.
00:57Every object on your form has properties associated with it.
01:02Even this blank area in the background has properties.
01:04If I click back here just on the dot grid where I don't have any objects,
01:08it'll switch to the properties for the Detail section, which is basically the background.
01:11And if I click between these two rulers here--this little box right here--it'll
01:16select the properties for the entire form.
01:19Now I can choose other objects by using this drop-down menu, and this list can
01:23get pretty long just because everything has properties including things like
01:27Labels and the Photo.
01:28So let's go ahead and take a look at the Properties for the overall form.
01:32You can choose it from the list here, or you can choose it by clicking the
01:35button between the rulers.
01:37Now the Property Sheet is split up into five different tabs.
01:40Let's take a look at them in turn.
01:42I'll click on the Format tab.
01:44Now there are a lot of properties here and we're not going to go through every
01:46single property that's available in the Property Sheet.
01:48So I'm going to call out a few that I think are particularly interesting.
01:51The first one I want to take a look at is this Caption here.
01:55Caption changes what displays on the tab when you view it Form view.
02:00Right now what's displaying is EmployeeDirectory, CamelCase with no space in the name.
02:05That's because that's what the form is named here in my Navigation pane.
02:08I'm going to go ahead and change the Caption to Employee Directory with a space in it.
02:15Now when I view it in Form View, it'll display Employee Directory with a space.
02:19Let's move down the list.
02:21The Default View right now is set for Single Form.
02:24If I click there, we'll notice it becomes a drop-down menu and I can choose from
02:28a variety of choices.
02:29I've got Continuous Forms, Datasheet, PivotTable, PivotChart, and Split Form.
02:35For our Rolodex-style Employee Directory, I'm going to choose Continuous
02:40Forms, which will make our records appear one on top of the other in a scrolling list.
02:44And right now here, I want to take a quick aside here and point out something
02:48that's kind of interesting with Access.
02:49If you go up to the Create tab and look at this Forms section in the Create
02:54Ribbon, you'll notice a bunch of buttons here for creating different forms.
02:57We've got Split Form, Multiple Items which is just a continuous list, PivotChart.
03:03If I click on More Forms, I'll see Datasheet and PivotTable.
03:09All that these do, they create basic forms that have this Default View set to
03:13their respective property.
03:15Instead of creating a form in Split Form view, you can create just a basic form
03:20and change it to a Split Form on your own.
03:21Let's go back into Design View. We'll continue taking a look at these properties.
03:26You can move up and down in the Property list by pressing the Arrow keys on your keyboard.
03:30So I can press Down to move down the list or I can press Up to move up the list.
03:34I can also press Right to move down or Left to move back up.
03:39And if you like working on the other side of the keyboard, the Tab key will move
03:42you down, and pressing Shift+Tab will move you back up.
03:47Let's go down to the Allow Form View.
03:49These next few properties, the Allow whatever View, will change what appears in
03:53this View drop-down menu.
03:55Right now I've got Form View, Datasheet, PivotTable, PivotChart, Layout, and Design View.
04:00We can turn some of these off if we're not going to be using them.
04:03Now Form View, we definitely want to use.
04:04That's the default view for working with the data.
04:06So we'll leave that one on Yes.
04:09But Datasheet View, I can choose this drop-down menu and choose No.
04:12I'm going to press Tab to go to the next one.
04:14Allow PivotTable View.
04:16I'm going to change this to No as well.
04:18Now since I know that the only two options are Yes and No, I can actually press
04:22N on the keyboard to jump to the No option.
04:24Then press Tab to go to Allow PivotChart View and again, to say No.
04:29And Allow Layout View, I'll change that to No as well.
04:33So moving through the Property Sheet with the keyboard can be a really fast way to
04:36navigate all these properties.
04:37Let's keep going down the list and we'll find some other properties that we can work with.
04:41I'm going to move down the list using the Arrow keys until I get to the
04:45Record Selectors property.
04:46Right now this is set to Yes.
04:48You'll notice the one below it, Navigation Buttons, is also set to Yes.
04:53Let's switch into Form View so I can point out what these two objects are.
04:55I'll switch my form into Form View and I could take a look at my form.
05:00Right now on the left side, I've got this gray bar with an arrow on it.
05:04This is my Record Selector.
05:06The Record Selector in a form is a little bit weird; let me point out what a
05:09record selector looks like in a table.
05:10I'm going to go ahead and open up my Employees table.
05:14In a table, a Record Selector is the same area; it's the same box right here.
05:17If I click on that, it selects that entire record.
05:19Let's go ahead and close the table.
05:22In a form, it does the same thing, except the record is almost the full height of my form.
05:26If I click on this box, basically, I'm selecting the same record.
05:30That's the Record Selector.
05:32On the bottom, I have the navigation buttons.
05:34These are these forms right down here.
05:35Let's go ahead and turn both of these off on our form. We're not going to need them
05:39for our scrolling directory.
05:41Switch back into Design View and you'll notice right here, my Form View and Design
05:46View are the only two buttons that I've got right now because I changed those options.
05:48We'll go back over here and we'll go to the Record Selectors and I'll change that to No.
05:55Navigation Buttons, we'll also change those to No.
05:59Let's go ahead and take a look at the Data tab.
06:01The Data tab is all about how our form connects to our data tables.
06:05This Record Source right here, you can see is a SELECT statement, and if
06:09you've taken queries in depth, you might recognize this as SQL.
06:13Basically when we were adding existing fields to our form from our data
06:16tables, Access in the background was creating a SELECT query to pull out those information.
06:21This Recordset right now is set to Dynaset.
06:25That means that this is a dynamic link between the form that we're creating and
06:30the data table that it's based on.
06:31I could edit the record's contents right here on the form.
06:35Now for my Directory List, I want this to be a reference that's real.
06:37I don't want people to be able to go in and change phone numbers or names for instance.
06:40So I'm going to set Recordset Type from Dynaset to Snapshot.
06:45That'll prevent any edits from happening while people are viewing the form.
06:49Let's take a look at the Event tab.
06:51The Event tab has all the different ways that can fire macros or Visual Basic
06:56code within our database.
06:58I can load a macro, for instance, when the form loads using the On Load event.
07:03I can load a macro, for instance, on the On Click event when somebody
07:07interacts with the form.
07:09I've got a Double Click event right down here, so I can load different macros
07:12when somebody double-clicks on something.
07:15I can also fire a macro when somebody clicks the mouse down and a different
07:19macro when they lift their finger up.
07:21There are lots of different ways that you can trigger events within your database.
07:25And all of these can add interactivity to your forms.
07:27Let's take a look at the Other tab.
07:30The Other tab has miscellaneous options.
07:32For instance, this Pop Up one here will create a floating window instead of a tab view.
07:38Modal will make your form force an interaction.
07:41In other words, the user can't open the form and transfer to something else
07:45without closing the form first.
07:47And finally, the All tab has a listing of all of the properties from the other four tabs.
07:52They're just in one long master list.
07:54So if you can't find something in the first four and don't remember where it's
07:57at, you can always go to the All tab and find it here.
08:00For instance, there's one property that I want to change called Order By.
08:04Let's see, if we can find it in the All tab.
08:06Let's scroll down the list, and here it is, Order By, and then the next one, Order By On Load.
08:15The Order By property will organize the records in a report.
08:19So we could tell Access how we want to sort these.
08:21We could sort by, for instance, Last Name or Employee ID.
08:25I'm going to go ahead and type EmpID and press Tab.
08:30Order By On Load, I want to make sure that's set to Yes.
08:33This will order all of my records based off of the Employee ID number.
08:36You could also choose to order the records based off of the LastName which will
08:39provide an alphabetical list of your employees.
08:41Now incidentally, I found the Order By here in the All tab.
08:47It normally resides in this Data tab.
08:49So I skipped it in the Data tab but I could still pick it up again in the All tab.
08:53Let's now take a look at our form and see the changes that have been made based
08:57off of these properties.
08:58I'm going to go ahead and close the Property Sheet.
09:01And before I view the form, I need to change its size a little bit.
09:04Since we changed it to a continuous form, it's going to repeat over and over again.
09:08The piece that will repeat is this entire Detail section, including all of this
09:12white space below all of my fields.
09:14So I'm going to go ahead and scroll down to the bottom, I'm going to grab the
09:18bottom of my form, and I'm going to move it way up to the top, so it's tight
09:21against the bottom here.
09:23Now the piece that will repeat is this section right here, and it'll repeat over
09:26and over again for each employee.
09:28Let's go ahead and view it in Form View, and now I've got a scrolling list. I can
09:33scroll through and see all of my employees within the company.
09:36Now the Property Sheet is an extensive resource for everything that you might
09:40want to control in your database.
09:41You will be happy to know that both forms and reports share this common interface.
09:46While some of the most common settings could be changed through the Ribbon tabs,
09:51the Property Sheet as generally my go-to resource because it gives access to all
09:54of the available settings, not just the most common.
09:57Often, I find the Property Sheet to be a great discovery resource as well.
10:02It allows you to find settings and options that you didn't even know you wanted
10:05to change until you saw them on the list.
10:07I definitely encourage you to go through the Property Sheet and explore some of
10:11those options.
Collapse this transcript
Adding a header and some polish
00:00We're going to wrap up our Rolodex- style Employee Directory here and add a
00:04final bit of polish using the Property Sheet to modify some additional objects within our form.
00:09We'll start by adding a Header section that will appear at the top of our form
00:12so that our end users will immediately know what they're looking at.
00:15As we go through this, keep an eye on the Property Sheet and you'll see the
00:19values change as we move things around and make selections.
00:21Now I've got the EmployeeDirectory open; it's the same form that I saved
00:24from the last movie.
00:25I'm going to switch into Design View, which is now really easy because I adjusted
00:29those properties to only show Form View and Design View.
00:32So now it's just a toggle button instead of having to go to this drop-down menu.
00:35I'll toggle into Design View and I'm going to open up the Property Sheet.
00:41If you remember, the shortcut key is either F4, Alt+Enter, or you can click on
00:46the button up here on the Ribbon.
00:48I'm going to click on the F4 key to toggle my Property Sheet open.
00:52Now let's go ahead and add the header section.
00:55On this bar that says Detail, I'm going to right-click and choose
00:58Form Header/Footer.
01:01That'll add a header section to the top and a footer section to the bottom.
01:04Now when Access displays my form, it's going to put the header at the top.
01:08It's going to have a Detail section and that'll repeat for every record
01:12in my Employees table.
01:14Once I run out of records, Access will display this form footer.
01:18Now we're not going to display the form footer in this exercise.
01:20So let's go ahead and minimize that out.
01:22We'll go to the very bottom and I'll drag it up to the top, and that'll make the
01:27form footer have zero height.
01:28And effectively it'll get rid of it.
01:29Now let's move up to the header section.
01:32I'll make that a little bit bigger so that I have room to work.
01:36Above the Detail, I'll grab this bar where it has this double-arrow and I'll
01:39click and drag down.
01:41Now I want to add a logo here at the top and a label here or a title. I'll press
01:47the Logo button in the Controls group of the Design tab.
01:50Press Logo and I'll browse to my Exercise Files which I've got on my Desktop.
01:55Exercise Files, Chapter 2, and I'll choose this TwoTreesLogo file.
02:00Go ahead and say OK and Access drops that into my header.
02:04I'm going to go ahead and make that a little bit bigger.
02:08Now I want to add a title. I'll press the Title button here on the Controls group.
02:13Access adds a title that's based off of the Caption for my entire form.
02:18If you remember, we set this in the last movie.
02:20I can view it if I click on the square between the two rulers.
02:24That will choose the properties for the form and we see that Caption is Employee
02:28Directory with a space.
02:29That's where this text is coming from.
02:32Now let's change the properties for the background, the header.
02:35I want to make this a green color that matches my logo and makes it look like
02:38a complete unit.
02:40I'll click on this area, any blank area on my header;
02:42it'll jump to the properties for the FormHeader.
02:45Now right now the Background Color is set to White and this is the
02:48hexadecimal code for white.
02:50I can use the drop-down menu to select a predefined color or I can click on the
02:55Build button to select a specific color.
02:57And I click on Build and go down to More Colors here and I happen to know the
03:04color of this green here, so I'm going to Custom and I type in those values.
03:09So for Red, 185, for Green 198, and for Blue, 170.
03:15I'll go ahead and say OK, and I'll press Enter to give me that change.
03:21And you can see the background of the header section changes to match the green in my logo.
03:24Now let's take a look at the properties of this title.
03:27I'm going to click on that and I'm going to change the font color.
03:32I could change it up here in the Ribbon or I could change it in the Property Sheet.
03:35Let me find Foreground Color right here.
03:39Right now it's set to Text Black.
03:41I could change it to a different color, use the Build button, and maybe I make it white.
03:47I'll press Enter to commit the change.
03:48I can also change the font, right here in the Property Sheet.
03:53I'll click on Font Name. We get a drop- down menu that lists all the fonts on my
03:57system, and maybe I'll choose a different font. Let's say Georgia.
04:02I can actually scroll through the list or I can Backspace off of this and
04:06just type in Georgia.
04:07It will jump right on the menu and I'll press Enter to commit.
04:10I want to show you one other thing here on the property sheet that I think is
04:13kind of interesting.
04:14I'm going to take the bounding box for my title and I'm going to make it
04:18a little bit bigger.
04:20Now we've seen up here in the Ribbon I've got options to Align Text Left, Align
04:24Center, or Align Right, and I can click on those and the text moves around
04:29inside of its bounding box.
04:30Inside of the Property Sheet, we can find the Text Align property.
04:35Right now it's set to Left.
04:37If I click there and look at the drop-down menu, I actually have a
04:40fourth option, Distribute.
04:42I can click on Distribute, and then it'll distribute the letters across the
04:46entire bounding box.
04:47So now if I expand this, they space out a little more.
04:50I can collapse it and they get closer together.
04:53So that's just an example where the Property Sheet has more options available
04:58than what's initially presented just in the Ribbon.
05:02There's our title, I've got my header section set up, let's go ahead and take a
05:05look at how our form is operating.
05:06I'll switch back into Form View.
05:10Now I've got a header at the section at the top and if I scroll through my
05:12records, we'll see that the header remains at the top no matter what record I'm looking at.
05:16Let's go ahead and change a couple of properties here for the rest of the form
05:20and we'll finalize everything up.
05:22One more time we'll go back into Design View.
05:24I'm going to click on the properties for this Detail section, clicking anywhere
05:29here in the background.
05:32And what I want to do is change the Alternating Color.
05:34So instead of the form being completely white, every other record will appear a different color.
05:40For Alternate Back Color right now it's set to No Color.
05:43I can use the Build button and I'm going to choose Green 2.
05:50Nothing really changes here on the form, but when we view it in Form View,
05:52we'll see that color.
05:53Let's see what that looks like.
05:55I'll click back to Form View and now every other row has a different color.
05:59A couple of other things I want to change here.
06:02Right now my Department has a white box which is masking the text below it, so I
06:06want to get rid of that.
06:07I also want to move this Employee ID number over just a little bit, so it lines
06:11up better with the image below.
06:13The last thing I want to do that is add a line between each record to further
06:16define where one record stops and the next begins.
06:19Let's go ahead and find those properties.
06:21Go back into Design View. Let's move that employee tag over, so I'll click on
06:26Employee ID and it'll scoot that over a little.
06:28We click on the Department field and turn its Background Color here from
06:34Normal to Transparent.
06:36I can also change the rest of these from Normal to Transparent as well.
06:40We'll click Zip and I'm going to Shift+ Click State, City, HireDate, and we'll
06:46just grab all of these for good measure.
06:48Change those Background Styles to Transparent.
06:50Finally, I want to add that line between records.
06:53That's a property of the form itself.
06:55I'll click on the square box between the rulers to select the form properties,
07:00or again, I could have chosen it from this drop-down menu.
07:04The property that I'm looking for can be found in the Format tab, and we're
07:08looking for Dividing Line.
07:10Let's go down here, there it is, Dividing Line.
07:13It's currently set to No;
07:14I'll change that to Yes.
07:15Let's take a look at how our form looks. And there we go!
07:19Our completed form.
07:22So there's our finished Employee Directory.
07:24The Property Sheet is really the master list of all the options that you have
07:27within your database.
07:28This applies not only to forms but we'll see it again when we work with reports
07:31later on in the course.
07:32It may look a little intimidating at first, but I would recommend that you spend
07:35some time reading through the list of available settings and I'm sure that
07:38you'll come across a few that stimulate your brain and make you think of new
07:41functionality that you can incorporate into your database.
Collapse this transcript
3. Form and Report Controls
Introducing form controls
00:00In this chapter, we're going to be taking a look at each of the control objects
00:04that are available to us when working with forms and reports.
00:07We've seen a couple of these in the last few movies, but I think it's
00:10important to explore each one individually, and see what some of the options
00:14we have when working with them.
00:16In this movie, we're going to take a look at the selection arrow and the label control.
00:20First I'm going to go up to Create tab and then click on Form Design.
00:24Now I want to set up this Detail section a little bit.
00:27By default Access displays this dot grid in the background, and when working
00:31with some of the little controls I think it's going to be a little bit
00:33difficult to see, especially if you're viewing this video on a smaller screen
00:36such an iPad or an iPhone.
00:38So I am going to adjust these dots a little bit. Let me go up to the Property
00:41Sheet and in the Format section, I'm going to scroll down to Grid X and Y.
00:49Right now these values are 24. I'm going to set them to 6, so I press 6 and Tab
00:53and then 6 and Tab again for the X and Y. That will get rid of most of the dots and
00:57I think it'll make this easier to see.
00:59Now let's take a look at our first control.
01:02In the Controls group of the Design Ribbon, this middle group of buttons,
01:05everything between these two lines, are all of the different objects or
01:09controls that you can add to your forms.
01:10We're going to be taking a look at this Label one. We will go ahead and click on
01:14Label and click once to add a label into our form.
01:19Now, when I did that, you'll notice that Access automatically deselected
01:22label and it turned on the selection arrow which is this white arrow that's
01:25used to select objects.
01:27By default, every time you add an object from the Controls panel down into your
01:31Detail section, Access will place one instance of that object and then return
01:35you back to the selection arrow.
01:38My cursor is inside of a new text box, it's flashing, it's waiting for me to
01:41type in some text, so I'm just going to type in Text and press Enter. I just
01:46added a single label to my form.
01:48Now, most of the other objects when you add them such as text boxes, buttons,
01:53some of these other images...
01:54When you add them in, you'll get not only the object, but you also get a label with it.
01:58The Label button adds labels that aren't attached to any other objects.
02:02It's just used for static text.
02:04This'll be good for things like titles or descriptions or any kind of
02:08instruction that you want to pass on to your end- user that's not dependent on a specific record.
02:13The label will create a static bit of text that'll always say the same thing
02:17every time you view this form.
02:19To add multiple labels, you can double-click on the Label button and that'll lock it on.
02:23Now I can add one label and I'll just write Text again and press Enter and it's
02:28locked on, so it still staying as a Label button.
02:30I can click again to add another text button, and I'll click again to add
02:35a fourth text label.
02:37When I am done, I can use the Select button up here to change back to the
02:43white arrow and to turn off the label.
02:45Now I've added multiple labels to my form. At this point, I can go up to the
02:50Arrange tab and we'll look out how we can move these around.
02:53If I drag a box around all of these to select them all, I could use this To
02:58Left button to move them all so they align to the left objects.
03:03I can say to the Bottom, which will move them all toward the bottom object.
03:06I'm going to go ahead and press Ctrl+Z to Undo both of those.
03:09I also have an option over here on the left, Control Margins. And if I open up
03:15that I've got different settings: None, Narrow, Medium, and Wide. And that controls
03:20how close the text is to the edge of the box in the top left corner.
03:24Press, if I click Wide, it'll increase the margin so the text box has actually
03:28moved the text outside of the expanded area.
03:31Let me go ahead and drag these boxes down a little bit, and since I have them all
03:34selected at once, it'll increase the size of all of them at the same time.
03:37Now I have expanded my box and I could see that the margin between the text and the
03:42edge of the box has been expanded. And just like we saw in the last movie, when
03:48we were looking at the alignment--the Left, Middle and Right alignment--there is
03:54actually more properties that we have available in the Property Sheet.
03:58So if I look at this Control Margins, I can just choose None, Narrow, Medium, or
04:01Wide, but in the Property Sheet, I can actually specify a value that I want.
04:05If I scroll down to the bottom of the properties to the Format section, I can set
04:11the Top Margin, Bottom Margin, Left and Right Margins to any value that I want.
04:15So for instance, I can type in 0.5 to make it half an inch.
04:19Again the text moves off the screen a little, so let me expand these out. And so
04:23it moved half an inch from the top of the box.
04:25This can help you really fine-tune your alignments in setting up your forms.
04:29And the Label control is one of the most common controls that you will
04:32be working with when you create your forms and reports. They are pretty
04:35much everywhere.
Collapse this transcript
Using lines and rectangles
00:00The next controls that I want to explore are the Line and Rectangle controls.
00:04They're useful for marking off space and grouping elements together in your forms and reports.
00:09Generally, they are pretty passive and not very exiting, but proper use of them
00:13can go a long way to making your forms and reports legible and unambiguous.
00:17I'm going to go ahead and open up this Controls form that I've saved from the
00:20last movie and I'm actually going to right click on it and say Design View.
00:24This is the one that I set up in the last movie that has the dot grid reduced in
00:29density, so it's easier to see what I'm doing.
00:31Up here on the Ribbon, in the Design tab, in the Controls group, I've got Line
00:36and the one right below it, Rectangle. I'll go ahead and select Line and I'm
00:41going to drag one out here in the form.
00:43Now as I drag a line out, one of the unique and kind of strange properties of
00:48lines is that when they're horizontal or vertical, which is the way you're going
00:51to want 95% of your lines, it's actually completely transparent.
00:56So you have to use the ruler at the very top to kind of get a estimate of
00:59where your line is.
01:01So if I go completely, exactly horizontal, I can't see it.
01:04If I go diagonal, I can see it.
01:06If I go completely vertical, I can't see it again.
01:09So it's just one of the strange quirks with these lines. So I am going to drag
01:12out a line here, and if I go up to my Ribbon here, I can change some of the
01:19properties such as Line Thickness.
01:21I can change it from a hairline to maybe at 2 point line. I could change its
01:26Dash Style or its Line Type. Probably don't want to make a line transparent;
01:29if you don't want it there, you could just delete it. But I can make it a solid
01:33line or dashed line. I've got some dotted options as well.
01:36We'll go ahead and select dots.
01:38I can also change its color here, Line Color.
01:41I could pick a color from the picker or I can say More Colors to type in a specific value.
01:45I'm just going to leave mine as black.
01:47I am going to click off of it, so you can see it, and now I've got a 2 point dotted
01:53black line. Let's take a look at the properties for a Rectangle. I'll click on
01:57Rectangle, draw one out.
02:01Now I've got the same properties I can change here--the Line Thickness, the Line
02:06Type, and the Line Color. I can also adjust its Fill.
02:10The Fill box is over here in the Font section, even though this has nothing
02:13to do with typing. But there is the Fill bucket. I will click on the Down
02:17button and I could use a color, maybe Green 4, and I can fill the interior of
02:23the box with a color.
02:24Now lines and rectangles also have another called Special Effect and if I
02:31move up into the Controls Ribbon, right up here to this button here, I can
02:35choose its Special Effect.
02:36Right now, it's set to Flat.
02:37I can choose from a couple of different options. I can make it a shadowed box, I
02:42can make it appear sunken or raised. I'm going to choose Shadowed.
02:46Now my rectangle has a shadow around it.
02:48I can see all of these in the Property Sheet if I open up the Property Sheet
02:53using this button here on the Ribbon and then click on my Rectangle.
02:56Notice I can see the Special Effect right here. Now this is Shadowed. So
03:00I've got the same options in my Property Sheet that I have from this button on the Ribbon.
03:03Now there is one other property that applies to lines and rectangles in
03:08particular. You can apply this to other controls, but it works really well with
03:11lines and rectangles.
03:12If I look at the Arrange tab, I want to take a look at this Anchoring option, so
03:16let me go ahead and click on this line here and click on Anchoring.
03:19Right now, the default is to anchor it on the top left, and what that's saying
03:23is that Access will move this far over and this far down, and draw a line that's this long.
03:29If I change its options to perhaps Stretch Across Top, what Access will do is
03:34use the margins from the left to the line and from the right to the line and
03:38then it will draw the line in between. So if my form gets wider, the
03:42relationship between the endpoints and the edge is what's going to be maintained,
03:45not necessarily the width.
03:46So if I switch into Home and change my View, you'll see that my line looks a lot
03:52longer than I drew it, but the space between the left side and the right side is
03:57what's now been fixed.
03:58So you can make your lines and rectangle a little bit dynamic to adjust to
04:02a user screen size.
04:05Lines and Rectangles play an important role in organizing other elements on
04:08your forms and reports.
Collapse this transcript
Organizing screen space with tabs
00:00The Tab control can be used to add extra space to your form or to group similar or
00:04related objects together.
00:06Adding a Tab control is a great way to organize your form, but it's not going
00:09to work very well on a printed report, since you will only be able to see the
00:12first tab when it's printed and trying to click on a tab on a paper report
00:16doesn't work very well.
00:17But for forms, they work great.
00:18I am going to take a look at this Controls Form. I will right click and say
00:23Design View. ThenRibbon we go ahead and add a Tab object, clicking this Tab Control
00:28up here in the Ribbon.
00:29I will drag out a box in the bottom of my detail section and that will add
00:34two tabs to my form.
00:36I can add additional tabs using this Insert Page button up here on the Ribbon.
00:42Press that once to add a third tab and a fourth tab.
00:45I can also add Tabs by right-clicking on the Tab Control and choosing Insert Page.
00:51If I want to delete a tab, just activate it, right-click, and say Delete Page.
00:59And if I want to rearrange pages, I will right-click again and say Page Order.
01:04This will bring up a window where I can choose a tab and move it up or down in the order.
01:10Go ahead and say OK to that.
01:11Now each tab presents its own area that we can fill with content.
01:16I am going to switch to the first tab here and add a label inside of it.
01:20I will click on the Label control and move down into the tab.
01:24When I do that, the tab turns black. That's telling me that whatever I am
01:27about to put in will appear inside of the tab and not just in the detail
01:31section of the report.
01:32So I'll move down here where it turns black and I will click to Add a Label and I'm
01:37just going to write, This is the first tab.
01:39Let's go ahead and move to the second tab. In here I can put another object.
01:43How about a Rectangle?
01:44I will click on the Rectangle control and I will draw in a rectangle.
01:49Let's go ahead and take a look at how these tabs are operating.
01:51We will go up to my View menu and switch into Form view and now when I am
01:56viewing my form, I have different tabs with different content.
02:00The first tab says, This is the first tab, the second tab has a rectangle, and the
02:04third and fourth tabs are currently blank.
02:06Let's go back into Design View and look at some properties.
02:09Go into View menu and Design View. And I want to change the name of these tabs.
02:15Right now Page5, Page6, Page7, and Page9 are not really doing it for me.
02:19In the Property Sheet--if it's not open, you can press F4 or the button up here,
02:24or press the Alt+Enter shortcut key...
02:27In the Property Sheet, we are going to look for the Caption property, which
02:29is on the Format tab.
02:30So with the Tab selected, clicking Caption. In here we can type in whatever we
02:36want to appear here in the tab.
02:37I am going to write Employees.
02:41Perhaps this is a tab
02:41where we are going to put a bunch of content that deals with working with our
02:44employees in our database.
02:45Let's go ahead and click on the second one.
02:49For its caption, I am going to write Reports.
02:52Maybe this is a tab where we put a bunch of content that deals with working with reports.
02:56You can go through and change all the tabs to identify what content is
02:59appearing within the form.
03:01Now, back into Form View, I have different content and I can tell what it is that
03:06I am going to do when I interact with that tab.
03:10So adding tabs can add some dimension and organization to your forms when screen
03:14space is at a premium.
Collapse this transcript
Adding buttons
00:00Buttons are one of the key interactive elements that you will use on forms.
00:04They instantly tell the end user that something will happen when I click here.
00:08Buttons will be linked to either Macros or Visual Basic code to control their behavior.
00:12Let's go ahead and try out a couple of button controls.
00:16In my database I am going to right-click on the Controls Form and say Design View.
00:19Now the Button control is this one right here, the rectangle with the four Xs in it.
00:24I like to call it the Button button.
00:26So we can go ahead, press the Button button and add one to our form.
00:30When I add it to the from, the Command Button Wizard starts, and this gives me a
00:35list of options that I can choose from for what the button will do.
00:38We've got categories for Record Navigation, I can go to the Next record, or
00:42Find a Record, I can Go to the First Record or the Last Record, Previous or Next Records.
00:49Under Record Operations I can Add a new record or Delete records.
00:51I can Print, Save, or Undo.
00:55From Form operations, I can apply a Filter.
00:58I can Close a Form or Open a Form, Print it, Print the Current Form, or Refresh Form Data.
01:06Under Report Operations, I can do things like Mailing a Report, Opening a
01:10Report, taking a look at in print preview view, sending it directly to the
01:14printer, or saving it as a file.
01:17In the Application category, I have got one option, Quit access. It's Quit
01:21application--it will shutdown your database. And finally in the Miscellaneous
01:25category, I have options for an Auto Dialer if you are connected to a phone,
01:30Print Table, Run a Macro, or Run a Query.
01:34Running a Macro and Running a Query are two of the most popular options with the Button Wizard.
01:38Let's go ahead and choose Form Operations.
01:40We are going to go ahead and open a form. Go ahead and say Next.
01:45Access now asks us which form do we want to open, and it gives us a list of the
01:49forms that are currently in our database.
01:50Let's go ahead and choose our Employee directory. I'll say Next.
01:57Access asks us if we want to display the Form with a specific record displayed
02:02or the entire form in all the records.
02:03Go ahead and just choose All records and say Next.
02:07And then we get to choose what we want to display on the button.
02:10We can either choose a Picture, like an icon here or we can type in some text, OpenForm.
02:14I am actually going to be a little more specific and I am going to say
02:18Open Employee Directory.
02:20Go ahead and say Next, and we will accept the default name. Press Finish.
02:26Now I have got a button on a form that will open the Employee Directory when clicked on.
02:30Let's go ahead and test it out.
02:31We'll go into the Form view and press the button. And there it is. My Employee
02:37Directory opens right up.
02:38Let's go ahead and close that down, and we will go back into Design View.
02:44We can take a look at the Properties for this button to see how it's functioning.
02:47If I click on the button and then go to the Event tab, we can see that the On
02:52Click event is set to this Embedded Macro.
02:55If we had other Macros that have been saved in our database and they were
02:59appearing here in the Navigation Pane, you could select this dropdown menu and
03:03choose those from the list.
03:05You can also click the Build button to edit those Macros that Access built for us.
03:09So I am going to click Build and it's going to show the Embedded Macro in
03:13the Macro Design tool.
03:15So this is the step that it produces. It opens a form and here are the arguments
03:19for that action. Which form? Employee Directory. Which view? Form view.
03:25We can change properties here and that will apply to what the button does.
03:27So if instead of opening it in Form View, we wanted to open it up in maybe Print
03:32Preview View, we can change that there.
03:35If we close the Macro it will apply those changes, and yeah, we can go ahead and
03:39save that. And now the button does something slightly different.
03:44Change back to Form View and press it and now my Employee Directory form opens
03:49up in the Print Preview window.
03:51Go ahead and close the Print Preview and we'll close the Form.
03:56So that's what a button does.
03:56You click on them and they do things.
03:59There is not much more to than that.
04:01The best thing about them is that they are instantly recognizable for your users
04:04and they provide the main interactive interface to your Access database.
04:08The key to fully leveraging buttons is understanding and being able to write
04:12Macros or Visual Basic Code.
04:14The better you get it writing Macros, the more functionality will be
04:17included in your buttons.
Collapse this transcript
Linking to external content
00:00The Hyperlink control allows your form to reach out beyond the local database
00:04and into your computer or out on to the Web.
00:07Let's add a Hyperlink Control to our form.
00:09I am going to right-click the Controls form and say Design View.
00:13The Hyperlink Control is this one right here with the globe and chain icon. I will
00:17click on that and the Insert Hyperlink dialog box opens.
00:20Let's go ahead and fill in some of these fields.
00:22I am going to first take a look at this Link to Existing File or Web Page.
00:27What we can do is link to a file that's outside of our database.
00:31For instance, inside of my Chapter 3 Exercise Folder, which just happens to be
00:35the Current Folder, I can select the Two TreesCatalog, which is a Word document.
00:40I can also look at Browsed Pages that are in my Internet History or Recent
00:44files from My Computer.
00:45I will go ahead and say OK to select the catalog and Access adds a link to that in my form.
00:52I can change the caption of what this says with the Caption Property. Right now
00:56it says TwoTreesCatalog.docx. I'm going to go ahead and change this to Open Two Trees
01:03Catalog, and I'll need to make it a little bit bigger so it fits all that text.
01:07I will drag it down to the middle here.
01:11Okay, let's go ahead in Form View;
01:13we will take a look at this.
01:14If I click on the link, Access tells me that we might have a little problem
01:18here, doesn't know exactly what we are linking to, but we can go ahead and say
01:21Continue, and Access will open up that Word Document in Microsoft Word.
01:26So I have now reached out into my computer and brought in additional content, so
01:30it's not taking up any more file size in the database.
01:32Go ahead and close that out. Now return to Access.
01:36I will switch into Design View, and we will look at a couple more hyperlinks.
01:40I will click on the Hyperlink Control.
01:44This time we can look at Object in This Database.
01:46When I select that, Access presents me the list, or tree view, of all the
01:50objects within my database.
01:52I can select Tables for instance, and that will show me all the tables in
01:56my database or I can expand Forms, and that will show me all the forms in my database.
02:00Let's go ahead and select the Employee Directory Form and say OK. That adds a
02:06second link to my form called Employee Directory, and again, I will change its
02:10caption. Employee Directory is a little bit vague. Let's go ahead and say View
02:15Employee Directory Form.
02:16I always like to tell my end users exactly what's going to happen when they click on it.
02:22So now they know they are going to be viewing this form.
02:25Let's add one more Hyperlink while we are here. Do Hyperlink and E-mail Address.
02:31Here we can specify that we want to send an email to somebody.
02:34So for instance, I can send an email to test@test.com and the Subject is "Here is an email."
02:42This Text to display will change what the caption says so I don't need
02:45to change it later.
02:47Send an E-mail to test.
02:50Go ahead and say OK, and that adds another link to my form.
02:54One more. We will add a hyperlink to a website.
02:56We will click the Hyperlink Control > Existing File or Web Page.
03:01I can select Browsed Pages to select from my browsing history from Internet
03:05Explorer, Recent Files or files that I have opened, or I can just type in an address.
03:11For Address I am going to type in http://twotreesoliveoil.com.
03:17Again, I can change this Text to display up here. Visit the Two Trees website. And say OK.
03:25So now I've got four hyperlinks here.
03:28Let's go ahead and test them out.
03:29I will switch into Form view, and let's first view the Employee Directory form.
03:35I click on that, any employee directory form which is in my database opens up.
03:39This functions identically to the button that we added in the last movie. Just a
03:42different way of doing it.
03:43I will go ahead and close the Employee Directory. This time, Send an E-mail to Test.
03:49I click on that, Outlook opens, which is my default email program on this
03:53computer. And it opens up a New message already addressed, already
03:56subjected, ready to send.
03:59Go ahead and close that. Don't need to save any changes. And the last one, I am
04:04going to click on the Visit Two Trees Website. When I click on that, Internet
04:07Explorer opens and it goes directly to the twotreesoliveoil.com website.
04:13Bringing in content from the web or from your local computer can be a great
04:17way to add dynamic content to your database without having to store anything within it.
04:22Training or marketing documents, customer testimonials, specs on products, and
04:26all kinds of information can be made available right within your database so
04:30that it's easy to get to when you need it.
Collapse this transcript
Entering and selecting data
00:00When it comes to displaying your data in forms, there are three objects which
00:04are used most often.
00:05They are the Text box, the Combo box, and the List box.
00:10Because these three controls work with data, we will have to connect our blank
00:13form to a data source so that they'll work properly.
00:15We are going to build a simple form that helps us enter in reviews into
00:20Table Reviews.
00:21We are going to open up that table and take a look at what's inside.
00:25The Table Reviews captures comments from our customers about our products.
00:29You get an identification number for the review, the product that was reviewed,
00:34the customer's rating and whether they give us permission to use the review, like
00:37on a website, and then the comments that they left for us.
00:40So let's build a form that helps us enter data into this data table.
00:43I will close the table.
00:45Let's go up to the Create Tab and we will do a new Form in Design View.
00:51And the first thing we need to do is connect our form to the data source or
00:56to the Reviews Table.
00:58We can do that in the Property sheet. Once again, our shortcut is F4 or
01:02Alt + Enter, or it's this button up here in the RRibbonibbon.
01:06Make sure we are taking a look at the Form properties and in the Data tab, the Record Source.
01:12It's a dropdown menu; we can select from a list of tables.
01:15We are going to choose the Reviews table.
01:18Now let's go ahead and add a couple of elements.
01:20First, I want to add a Text Box. I can click on the Text Box control in the
01:24Design Tab of the Ribbon.
01:25We will click in our form somewhere to add a Text Box and now I will link this
01:31Text Box to a field on our table.
01:33Under the Control Source I can use this dropdown menu that shows me all the
01:37fields in the table, and I am going to choose ProductID.
01:40Let's add another Text Box for the Comments field.
01:42We will create another Text Box, we will click down here, we will change its
01:48Control Source to Comments.
01:50Now the Text Box for Comments needs to be a little bit bigger because the
01:54comments fields is a memo. We want people to be able to type in some comments
01:58here, a long comment, so I will drag this box open and make it a little bit bigger,
02:01so we have room to write.
02:03I'm going to go ahead and view my Form to see what it looks like.
02:05I can scroll through the three records that make up our Reviews Table right
02:10now. So this is Record #1, Record #2, and Record #3.
02:15I can add a New record by clicking this new blank record button here, but now
02:19I have got a problem.
02:21I want to type in a Product Review for a specific product.
02:24And in order to do that with this table the way it's set up, I will have to type
02:28in the product identification number and if I don't know what that is, this form
02:32isn't giving me any help.
02:33So let's go back into Design View, and we will fix this a little bit using a
02:36Combo Box, so it can provide some context and help us enter in our review.
02:40I will go back into Design View and I am going to delete this Text Box here for ProductID.
02:47The Combo Box and the List Box controls here on the Ribbon--this button here is
02:51for Combo Box, the one right below it is for List Box--
02:55These two controls provide lists of objects that we can select.
02:58Now the Combo Box and the List Box are functionally identical.
03:02The only difference is that the Combo Box collapses to a single row when you are
03:05not using it, whereas the List Box, this one, stays open all the time and
03:10displays the values in the list.
03:11I am going to choose the Combo Box and we will click in our Form to add it.
03:17The Combo Box and the List Box both have wizards associated with it.
03:21The first question on the wizard is how do you want your Combo Box to get its values?
03:25We can choose "I want the Combo Box to look up the values in a table or query."
03:30The second option says we can type in the values that you want and make a list
03:33on our own, or we can use a Combo Box to search for a record in our form.
03:38I want to make this a dynamic list, so if we add new products to our database,
03:42that list expands as well.
03:43So I am going to say, I want the Combo Box to look up the values in a table or query.
03:47Go ahead and say Next.
03:50Now it's going to ask us which table or query is going to provide that list.
03:53Now you might think that you want to connect this list to the Reviews table.
03:56But let's think about this for a moment.
03:58If I connect the list to the Reviews Table, all it's going to show me are the
04:02products that have already had reviews written for them; in this case we only have three.
04:06What I really want to do is provide a list of all the products in our database.
04:09So I am going to choose the Products table instead.
04:12This will give us that complete master list of everything that we carry.
04:16I am going to say Next. Now I get to choose which fields do I want to show up in the box.
04:22I want the ProductName, so it's easy to choose from the list.
04:24We will move that over from Available fields to Selected fields, and say Next.
04:31How do you want to sort these?
04:32We can make sure that it sorts alphabetically base off the Product Name, or we
04:36can sort them numerically by the Product ID number.
04:38I am going to choose ProductName and leave it as Ascending.
04:44Click Next, click Next again.
04:46Now Access asks us what does it want us to do once we've made a selection in our list.
04:51It can either remember the value for later use or store the value in a field.
04:56"Remember the value for later use" will simply allow us to make a selection and
05:00then it will hold that selections value in memory, so that we can reference it
05:04later, for instance, from a query.
05:07If we choose to store the value in a field we'll actually change data in a
05:10data table. We are going to create a new review so we want to store that value
05:14in the Reviews Table.
05:15Go ahead and choose the ProductID as where it's going to save that value.
05:18We will say Next, and we will accept the default name. Say Finish.
05:24Now our products have kind of long names, so I know I need to expand the slider.
05:28Let me click and drag on the right side to make it a longer list, and we can
05:33go ahead and check out our functionality.
05:34I will go to the View tab and change it back to Form View.
05:38Now if I go to create a new record--I will click on New Blank record here on the bottom--
05:42I've got a list of all the products in our database.
05:46I can easily scroll through the list, find the oil that I am interested in
05:51writing a review for--say Refined Oil 32 oz size--and now I can type in the
05:57comments that I have about that particular product:
06:00This oil is a fantastic value.
06:05At this point I can go ahead and finalize that comment by moving forward to a new
06:08record and I can take a look at my Reviews Table to see that change being made.
06:13So now I have a Review here: This oil is a fantastic value.
06:17Now there are a couple of additional fields in our data table, the rating and
06:21public fields, and we will add controls to our form in the next chapter.
06:25But for now, if we switch back to our form?So instead of using a Text Box,
06:29where we have to manually type in the name of our oil, by using a Combo Box, we
06:33can easily select it from a list to ensure that every time we type in a value,
06:37so that it's entered consistently and that the values match the records that are
06:40already in our database.
Collapse this transcript
Controlling input with option groups
00:00We're going to continue editing our Reviews form for entering data into our Reviews table.
00:06Let's take a quick look at the Reviews table one more time.
00:09And now I need to add some elements that help us deal with this Rating column
00:12and the Public column.
00:13The Public column is a Yes/No field and by default in a table, it shows up as a checkbox.
00:17The Rating column is a number field.
00:20We could type in whatever number we want but we want to restrict users to a 1
00:23through 5 scale. But we also want to identify what 1 through 5 means,
00:28so we can do that on our form.
00:29Let's go ahead and close our Reviews table.
00:33We'll go back to our Reviews form that we were working on in the last movie.
00:35I'm going to switch into Design View and we're going to take a look at a couple of
00:40elements that deal with the Yes/ No data type like our Public field.
00:45In the Control section of our Design tab, we've got the Check Box, the Option
00:51Button and sometimes it's called a radio button.
00:53We also have a Toggle Button, that's this icon up here.
00:57Let's go ahead and add one of each of these elements onto our form.
01:01Take a Check Box and drop it onto our form, we'll take a Radio Button and drop
01:07it on our from, and I'll take a Toggle Button and drop it on our form.
01:13Now each of these presents data in a slightly different way but they all do
01:16basically the same thing. They either check on or check off, turned on or
01:21turned off, pressed or unpressed.
01:25Let's go ahead and connect all of these to our data source.
01:27I am going to select the button, I'm going to Shift+click and select the Radio
01:33button or the Option Button, and I am going to click on the Check Box to select
01:37all of those three at once.
01:39Now, in the Property Sheet on Data tab, I could change the Control Source for
01:43all three at the same time.
01:45For the Control Source we're going to connect this to the Public field, which is
01:48that Yes/No data type.
01:51Okay, let's check it out on our form.
01:53Switch into Form View. And we can see that the first record has this check mark turned on.
01:59The check is on, the radio button is on, the button is pressed.
02:03If we cycle through our records, we can find one where they're all off.
02:06Now since they're all connected to the same field, they'll all be in the same
02:10state at the same time.
02:11So, record number 3, they're all on, record number 4 they're all turned off.
02:16Let's go back into our Design View and we're going choose to use the Check Box.
02:23The Option button and the Toggle Button, we can get rid of.
02:26Click on each one and delete them.
02:30Let's move our check box to the bottom.
02:34Click and Drag it down.
02:35I want to change the label associated with the check box, so instead of Check6
02:40it says, Can we use your comment on our website?
02:48This tells the end-user exactly what this check box is doing.
02:51Now, it's being stored in our Reviews table under the field Public, but on
02:55the form that the user is interacting with, it's more specific about what
02:58that checkbox means.
02:59While we're doing it, we can also change the labels for the other fields.
03:02This one here is the Comments field.
03:03We can change it to "Please share your comments" and I'm going to move it above
03:10using the handle in the top left corner to drag.
03:13Let's change this one too.
03:16Instead of Combo4, I'm going to choose to just ask, Which product are you
03:19reviewing? And again I'll move that above the field.
03:23The next thing I want to do is give our customers the opportunity to leave a numeric review.
03:30For that I'm going to use a control called the Option Group. That's this box up
03:34here in the ribbon; it's got this box with the XYZ in it.
03:37I'll click once, and then add that down into my form.
03:41The Option Group Wizard starts and it asks us to label each of the options
03:46that we want to present.
03:47Now, these can be numerical fields like 1, 2, 3, 4, 5, or again I like to be
03:52really specific. I want this to say exactly what I mean those to be.
03:56So, instead of 1, 2, 3, 4, and 5, I can say something like this.
03:59The first one is going to say Excellent, the next one Good, the third one
04:04Average, the fourth one Below Average, and the fifth one Poor.
04:11That's going to be what the end- user will select from the list.
04:14We'll go ahead and say Next.
04:16The next screen asks us if we want any of the options to be the default choice.
04:19Now, I don't want to skew our results at all, so I'm going to choose No, I
04:22don't want to default.
04:24We'll go ahead and say Next.
04:26Now, our Access wants to know what values we're going to assign to these labels.
04:30The user is just going to see the label.
04:33The value is what's going to get stored in our data table.
04:36Now, I've got these in backwards order right now with Excellent on top.
04:39So, I want to Excellent tag to actually be the value of 5.
04:42So, I'm going to type 5 there and press Tab.
04:44I'm just going to go through this list and renumber these. So Excellent is 5, Good is 4,
04:50Average is a rating of 3, Below Average equals 2, and Poor is 1.
04:55Again, this is what the end-user will see in the Label Names. The values are what'll get stored.
04:59Go ahead and say Next.
05:02Access now wants to know what you want to do with that value.
05:05We can save it for later or we can store it in a field.
05:07I'm going to store it in the Rating field for my table.
05:12Go ahead and say Next.
05:14This window here is asking us how we want to display this.
05:18We have the option of an Option button, a Check box, a Toggle Button.
05:22There's a couple of different rules of thought here.
05:26Generally, check boxes are reserved for options where we can choose more than
05:30one option at a time.
05:31So, I don't think that's going to be a good option for this.
05:34Option Buttons and Toggle Buttons will both work.
05:37I'm going to choose the Toggle Button option.
05:41This group down here asks us which style we want to use and we could choose from
05:44Flat, Raised, Shadowed, Sunken. Just some different options for how we want the
05:50style of the box around it.
05:51Now, we could always change that in the Property Sheet later.
05:54So don't feel like you need to make a decision at this point; you can change it
05:57later if you change your mind.
05:58I am just going to stick with the Etched.
06:00Go ahead and say Next.
06:02What do we want to call this box?
06:04Right now, it says Frame11 and I'm going to go ahead and change this, and I'm going to
06:08make it say Rating, and say Finish.
06:13Access adds that Option Group to our form here and we can move it around. We'll
06:17drag it maybe over here to the left. And now let's go ahead and check out our
06:21form and see how it's functioning.
06:23I'll switch my view into Form View.
06:25Now, we can scroll through the existing reviews that are in our table, review
06:29number 1, review 2, review 3.
06:33Review 4 was the one we put in where we selected this box and typed in the value
06:36but we weren't able to select a rating because that wasn't created yet.
06:39So, let's go ahead and give this a rating.
06:41This was a fantastic value; it gets an Excellent rating.
06:43Can we use the comment on our website? Yes, you can.
06:47Now if I go through and create a new record, it will save that to our Reviews table.
06:52Take a look at our Reviews table and we see that Review has now been
06:55populated into the table.
06:56So, now we have an easy form where we can capture customer reviews about all of our products.
07:01Let's say a new record, choose a product from the list, don't have to type in
07:05there, choose the Rating, how about Good.
07:09Share our comments, Another comment. And we don't want that to be used on the
07:14website, so I will leave that on blank.
07:17So, by using controls like Check Boxes, Option Groups, Combo Boxes, and List
07:22Boxes we give our end users multiple ways to enter data into our data tables.
Collapse this transcript
Attaching documents
00:00In this video we'll explore the controls for working with attached files.
00:04Now, there's plenty of debate on whether you should actually attach additional
00:07files such as images or Word documents to the record within your database.
00:11Some people claim that it leads to database bloat and unnecessary slowdowns.
00:15I definitely recommend the hyperlink option as a good way to include links to
00:19additional resources without actually embedding everything in the database.
00:24But when you do have file attachments and OLE object fields within your tables,
00:28you'll need to know how to actually make use of them.
00:31Working with them and their forms requires the use of the attachment control and
00:34the bound object frame control.
00:36I'm going to go ahead and open up my Employees table here, double-click on it,
00:40and scroll to the right. And the last two fields in my Employees table are the
00:45Attachment field that currently has the headshot or the photograph of a few of
00:49our employees and I have a field for OLE objects.
00:53Now, OLE stands for Object Linking and Embedding and it's kind of an older way to
00:57attach files to your database. The Attachment field is the newer way.
01:00Let's go ahead and close this out and we'll create a form that looks at these two fields.
01:04We'll go to the Create tab and create a New form in Design View.
01:09First, we need to this form to our Employees table.
01:13So, in our Property Sheet, with Form selected, we'll go to the Data tab and
01:18change our Record Source to tbl_Employees.
01:20Now, let's add those controls for working with the attachments.
01:23I can do it in a couple of ways.
01:25If I go up to the Controls section, the paperclip icon is the Attachment field.
01:29So, I can select it and drop it down here and attach the Control Source to that object.
01:36So, the Control Source for that is going to be Photo from my Employees table.
01:40I could've also gone to this Add Existing Fields button and added it right from here.
01:45So, if I scroll down through my table of employees, I'll find Photo, and if I
01:51double-click on that, that adds the Attachment field as well.
01:54So, it added a second instance of this photo.
01:56We'll go ahead and delete that one.
01:58Now, I can also add a control that deals with our OLE object.
02:01We're going to use this Bound Object Frame.
02:05It's this icon here with the cactus and the XYZ.
02:08So, click on that once and I'll click down into my form to add one.
02:11I'll go to my Property Sheet I'll set the Control Source for that to the OLE field.
02:17Now, just like we saw with the Photo, we could've gone to Add Existing Fields
02:22and added it right here.
02:23It does the same thing. Adding a blank object and then linking it, or adding it
02:27from the Field List, does the same thing.
02:29Let's also add one more control here.
02:31There's this one here called the Unbound Object Frame.
02:34It's the same icon, but without the XYZ, so it's got the cactus in the road.
02:37I'll click on that and I'll drag out a smaller box right here.
02:42Now because this one is unbound, it's not linked to any specific record in our
02:46table; it's linked to the form itself.
02:48Access asks me what kind of document do I want to attach here.
02:53I can either create the attachment from an existing file or I can create a new
02:57document directly inside of the form.
02:59For instance, if I click Bitmap Image and say OK, Access will open up Paint,
03:05which is the default program on this computer to deal with bitmaps and I can
03:08just scribble in something here.
03:09Go ahead and close this out and Access saves that object right inside of my form.
03:15So, this file doesn't exist on my computer anywhere, except inside of this form
03:19object inside of my database.
03:22Same thing is going to apply to the linked objects in this OLEBound field, but
03:26instead of being linked to the form, it's going to be linked to the specific
03:29employee that we have selected when we create it.
03:32The Photo is also linked to the employee.
03:34Let's go ahead and take a look at this in Form View.
03:37We can see the photo for person number 1 and we've got an OLE object field that
03:44we can right-click on and say Insert Object.
03:47We can choose an object to insert and create a new document, and there's a long
03:52list of documents that we can work with.
03:53Some of these work better than others. For instance, WordPad document.
03:58If I say OK, it will open a New document in the WordPad.
04:01Let me close that out.
04:03Instead I'll right-click and say, Insert Object, and we'll choose a PowerPoint slide.
04:09Now, PowerPoint slides are handled a little bit differently.
04:12When I say OK to that, Access actually opens up a small PowerPoint design
04:18environment and I've got this little teeny side down here that I can't really
04:21resize beyond the bounds of the control.
04:24So it's a little bit more difficult to work with a PowerPoint slide. It doesn't
04:27open in a full window.
04:29But we could add a pre-existing PowerPoint slide, and that seems to work pretty well.
04:33We'll actually click off of it anywhere and then I'll unselect it.
04:37One more time I'll right click inside this Bound Object frame, say Insert
04:42Object, Create from File, and then we can browse to a file we want to embed.
04:47I'll say Browse, Chapter 3, and I'll choose the TwoTreesCatalog. We'll say OK.
04:55We'll say OK again, and it takes a moment to bring that into my database.
05:00Now, I've got my Two Trees Olive Oil Word document saved, attached to the
05:04record for Employee #1. If I go to Employee #2 by selecting next record, you can
05:09see that the same unbound object applies, because this is attached to the form
05:12itself, but the unbound object is blank.
05:15So I can choose an additional file for the second employee.
05:18Let me go back to the first.
05:21If I right-click on the object inside of the Bound Object frame, I can choose
05:25Document Object and then Open, and that'll open up the original Word document
05:30inside of an editing window in Microsoft Word, where I can make changes and it'll
05:35save it right back into my data table.
05:36Let's close that out.
05:39Having attached objects in your database, such as this Word document or these images,
05:43really does increase the file size of your database by quite a bit.
05:47So, I definitely recommend working with the Hyperlink option if at all possible,
05:50but when you do need to have file attachments attached to records within your
05:53database, the OLEBound object and the Attachment field are the ways to go.
Collapse this transcript
Attaching images
00:00In the last movie, we talked about the Bound Object control and the
00:03Attachment control for working with files that were directly attached to
00:07fields within a data table.
00:09Now, I don't want to make it sound like I'm recommending you don't work with
00:12images at all within your database.
00:14The tasteful application of selected images within your forms and reports can
00:18add some much needed personality and make it fun for your end users to work
00:21with your database.
00:22I do want to take a look at the Image control and how that can add to your forms.
00:27I'm going to right click on our Controls form and say Design View.
00:33The Image control is this one here, the one with the mountain and the little sun icon.
00:36I'll click on Image and click once to add an image down to my form.
00:41That opens up this Insert Picture window, Chapter 3, and I am going to choose
00:48this Ojai 500x300 image.
00:49Go ahead and say OK and Access adds that image onto my form.
00:53Now, there're a couple of other ways you can add images to your forms.
00:57For instance, we've seen this Logo button previously.
00:59If I press Logo and choose the same picture, Chapter 3, Ojai500x333, say OK to
01:08that, the logo actually adds into the Form Header section.
01:12So, in order to add a logo, Access added this From Header and placed it right up
01:16here in the top corner.
01:17A logo is always going to appear in the top left corner.
01:20But in the end, all it is is an image, so I could have just made a header myself
01:24and added the image in the same place.
01:25So, let me go ahead and delete that.
01:27That's what a logo looks like.
01:28I'm actually going to right-click here and say Form Header/Footer to turn
01:32the Header section off.
01:33So, this is what an image looks like.
01:35It's basically just placed in the middle of my form.
01:37We can take a look at some of the properties that come with the image.
01:40I'm going to open up the Property Sheet and let's first shrink this window to
01:45see what happens to the image when I shrink its bounding box.
01:48I'm going to click on the bottom and drag up.
01:51When I do that, the image shrinks to fit within the bounding box.
01:54By default, if I look at its properties on the Format tab, its Size Mode is set to Zoom.
02:01We've got a couple of different options here.
02:03I can choose from Zoom, Clip, or Stretch.
02:07Clip is going to clip the image or essentially crop it to the bounding box
02:11that I've selected.
02:12Stretch will distort the image, so we'll stretch it out wide and distort it.
02:16Let me go ahead and change this back to Zoom.
02:19I can also change the Width and Height manually.
02:22So, instead of dragging, I can type in specific values.
02:24So for instance, I can type in 2 inches for the Width and 1 inch for the Height
02:28and Access will fit the image within that box.
02:32This kind of an undocumented feature; you can actually type in, instead of just
02:35inches by using the quotation mark,
02:38I can type in centimeters. So I can type 2cm and it'll convert it.
02:44I can also work with pixels, which is kind of interesting.
02:47You can type in 500px and it will make it 500 pixels wide.
02:53For the Height, I know this image is 500x333 so I can type in 500 wide, 333
03:00for the height, finish that with px, and press Enter, and it return me to the
03:05actual size of this image.
03:06As with most of the other controls, I can also add a border or a line style around it.
03:10I can go up to this Line menu and choose 4 point and it'll add a 4 point
03:16border around my image.
03:17Let's go ahead and delete this out and I'll look at one other way that we can
03:20use images in our forms.
03:22If I select my Form here by choosing the box between the two rulers here, it'll
03:27select the Form in my Property Sheet or I can select Form from the dropdown
03:31menu here. Select Form.
03:33We can add a picture to the background of our form.
03:35Right here I've got this Picture property; right now its set to none.
03:39If I click on the build button, Chapter 3, and choose the same Ojai500x333 and
03:46say OK, Access adds this into the background of my form.
03:50Now it won't get in the way if I try and click on it.
03:52I'm going to select the properties for my Form again and take a look at some other options.
03:57I can choose to tile this.
03:58Now, this image isn't a tile-able image, but if I had a background pattern, for
04:01instance, I can turn on Tiling and it'll tile the same image across the field.
04:05So, I'm going to choose that back to No.
04:08Picture Alignment--I can choose from Center, Top Left which will move it to the
04:13top left corner, Top Right, Bottom Left, or Bottom Right corner, if I want to
04:17attach it to a specific corner.
04:18We can also choose to have this either Embedded, which it does by default, or
04:23Linked, in which case it won't add any file size to our database; it just has to
04:27be able to find it in our computer.
04:29So, if I change this from Embedded to Linked, Access is going to ask if I want
04:32to remove it from the form.
04:34I do, and now I just need to go back up to my Picture field. This is now set to Linked.
04:39I'll go to my Picture field and build one more time.
04:43Chapter 3 and choose it again. And now instead of embedding the file within my
04:48database, it's just referencing a link to its file location.
04:52So, it's not adding any size to my database.
04:54Now, you can get pretty creative with embedding images within your forms.
04:59For instance, this particular image seems to fade to white as it gets to the top.
05:02I can take advantage of that by making my form exactly the same width of the image.
05:07If I drag my form closed, now it looks like the picture starts at the bottom
05:11and goes all the way up to the top, even though the image actually ends right about here.
05:16So by being a little bit creative with your application of images within your
05:19forms, we can create some interesting effects.
05:22We'll see this later on the course as we apply images to our forms.
Collapse this transcript
Understanding the subform control
00:00Subform controls allow you to create linked table-like displays of information
00:04that are related to a main topic.
00:07Now, we saw an example of a Subform briefly in the beginning of this course
00:10when we used the Form Wizard to display a list of all of the orders that
00:14included a specific product.
00:16Let's go ahead and duplicate that form manually using the Subform control.
00:20First, I'm going to go up to the Create tab and we'll do a new form in Design View.
00:25Subforms take up a lot of screen real estate and that really makes them a
00:28perfect candidate to pair with a Tab Control.
00:30So, let's add a Tab Control to our form here.
00:34So, I'll use this tab button here, and I'm going to draw out a Tab Control that
00:38takes up the majority of this form.
00:40And I'll just Ribbondraw a box up there.
00:42So, the first thing we need to do is connect our form to the data source that we want to use.
00:47We're going to be creating a form that takes a look at a specific product
00:50and then within the tabs shows information about the orders that included that product.
00:54So, first I'm going to go up to the Property Sheet.
00:56I'm going to change my properties, so I'm looking at the properties of the Form.
01:01Underneath the Data tab, I'm going to go ahead and set the Record Source here
01:06to my tbl_Products.
01:08Next, I'm going to go to my Add Existing Fields button on the Ribbon, click that
01:13and I'm going to add ProductID and ProductName to my form.
01:17I'll just click on the first one, Shift+Click on the second one, and drag and
01:22drop them on the top of my form in the Detail section.
01:25Now I know my product names are pretty long, so I'm going to go ahead and expand
01:27this box a little bit and that'll keep everything nice and neat.
01:30So, now let's go ahead and add the Subform that'll relate to the products
01:34that we selected in the main form.
01:36The Subform control is here on the Ribbon.
01:38I'll go ahead and click that once and then come down into my Tab Control.
01:42When the Tab Control turns black, that means whatever I'm about to do is going to
01:46happen inside of the tab.
01:47I'll go ahead and click and drag out a box for my Subform and Access brings
01:52up the Subform Wizard.
01:53The Subform Wizard gives me two different options.
01:56I can either use existing tables and queries, or I can use an existing prebuilt form.
02:01We'll take a look at the existing prebuilt form and we'll put one in Tab 2 in just a moment.
02:06For now, just go ahead and choose Use existing Tables and Queries and click Next.
02:10We're going to be adding information that relates to the products from our Orders table.
02:14We'll go ahead and up here, select my Orders table, and I'll add OrderID and
02:21ProductID to the Selected Fields pane.
02:23I also want to know who ordered these products.
02:26So I can go back up to the top, pull from my Direct Customers table and I can
02:31grab FirstName and LastName. We'll press Next.
02:36In the next Window, Access wants to know how are these two tables related to the
02:40main table, the Product table.
02:43It's correctly identified that the relationship is based off of the ProductID.
02:46Go ahead and say Next.
02:48We can go ahead and accept the default file name here and say Finish.
02:52Now, Access added the Subform to our navigation control down here, and it also
02:56placed it inside of our Tab Control here.
02:59I'll go ahead and expand this out to fill up my tab, and I can also delete the
03:04label that came with it.
03:05I'll click on the Label and I'll press the Delete button.
03:09Now I can move my Subform up a little bit to fill up the tab.
03:12So, my first tab is populated. Let's go ahead and put a second one in Tab 2.
03:17I'll click on Tab 2 to activate it, I'll move back up to the Design tab of the
03:21Ribbon, click on the Subform control here, and draw the box again inside of Tab 2.
03:29This time we'll choose to use an existing form and I'll choose the Reviews form
03:33that we built earlier in this chapter.
03:34Let's go ahead and say Next.
03:37Access again asks us how these are related, and it's correctly identified that
03:41they're related off of the ProductID.
03:42So, I'll say Next and I can go ahead and accept the default name again and say Finish.
03:47Access places an instance of the form that we build earlier inside of this tab.
03:51Once again, I'll go ahead and delete the label and I'll resize my form a little.
03:55Now the only thing I need to do is change the text that's on the tabs.
04:02I'll click on the Page1 tab.
04:05I'll close my Field List and open up the Property Sheet.
04:10On the Format tab you'll find the Caption property, and this is where we type in
04:15the text that we want to appear on the tab.
04:17For this one, the first tab, I want to Caption to read: Orders.
04:21So, I'll type in Orders and press Enter.
04:23Let's go ahead and switch to Tab 2.
04:26Now, for the Caption for Tab 2, I want to put the word Reviews and press Enter.
04:34That changes the name of the tabs.
04:37Let's go ahead and take a look at our form and see how it's working.
04:40I'll switch into Form View here, and now I can scroll through my products--I've
04:44got 90 products in our database.
04:45I'll go to product number 8.
04:47Product number 8 is our Extra Virgin Olive Oil in the 32 oz size.
04:54In this first tab I've got a subreport that's showing me all of the orders that
04:57included this product.
04:58I've got the OrderID, the ProductID, and then the name of the person who ordered it.
05:04In the second tab here, I've got another Subform that's displaying the contents
05:08of the Reviews form that we built earlier.
05:10So, I can see the reviews that have been placed for this particular product, and one
05:14person we see has rated it Good.
05:16So the Subform object brings in yet another way to view your content, and by
05:21pairing Subforms with a tab control, allows us to keep related information
05:25together in one space efficient location, so that it's easy to get to.
Collapse this transcript
Adding charts
00:00The chart control can give insight into your business's metrics by presenting a
00:04dynamic, graphic view of your data that changes as your database grows.
00:08Unlike exporting data to Excel and graphing there, creating your graphs
00:12directly within Access maintains the live, always updated link to your data
00:16tables and queries.
00:18Further, paring a chart with a query gives you all the flexibility of adding
00:21query criteria to instantly refine the chart's dataset.
00:25The Chart Object within Access is a feature that hasn't been updated in several versions
00:30and it can be a little bit difficult to work with.
00:32I will leave it to you to decide if the insight that they provide is worth the
00:35effort it takes to create them.
00:37But in this movie, we are going to create a chart object.
00:40And in the next movie, we will bring this chapter full circle and incorporate
00:44some of the other form controls that will take user input and alter the charts parameters.
00:49Now the first thing we want to do is identify what it is that we want to chart.
00:52We are going to go ahead and create a chart that looks at the number of orders over time.
00:57We can build this chart directly off of a table, but instead, we can build a
01:01query that will gather the data first, before feeding it into the chart.
01:04So let's go up to the Create tab. We will create a new Query in Design View.
01:08I am going to build a query off of my orders table.
01:12I will double click Orders and say Close.
01:15From the orders table, I need the OrderID and the OrderDate.
01:19I will double click on each to add it to the Query Design Grid.
01:24We can go ahead and run this query to see the results.
01:27And we will see that I have 2200 records displayed.
01:30Let's go ahead and save this query, so we can use it in the chart.
01:33I will name it qry_OrderDates.
01:36I will press the Save button up here or press Ctrl+S get the Save
01:40dialog, qry_Orderdates.
01:44
01:45Go ahead and say OK and we can go ahead and close the query.
01:50Now let's start our chart.
01:50We will go up to the Create tab, and start a new Form in Design View.
01:54I will make the form a little bit bigger. I am going to drag the edge over
01:58it to about the 10 inch mark and I'll scroll down to the bottom and move it up a little bit.
02:02The chart control is this one here, with the three bars.
02:07I will click on that once and drag in a box to insert my chart control.
02:11The Chart Wizard starts and Access wants to know where the data is going to come from.
02:15Again, I can choose one of my tables or I can choose my view to Queries and use
02:20the Query we just built.
02:21I will select it here and say Next.
02:25Now the query we built was specifically built for this chart, so I will just go
02:28ahead and take both fields by clicking the double arrow to add it to the Fields
02:32for Chart section.
02:34Go ahead and say Next.
02:36The next window asks what kind of chart we want.
02:38Now we have lost different options. Some of these will work better for some
02:42data types than others.
02:43For this chart I am going to choose the simple line graph.
02:46Go ahead and click the Line Chart button here and press Next.
02:50The next screen asks where the data is going to fall.
02:53And Access tries to fill these boxes in for us. It usually gets it wrong, so let's
02:56go ahead and drag these little fields off of the drop zones, so we can start
03:00with a fresh screen.
03:01Now on my X-axis on the bottom, I'm going to put the date.
03:05We will drag OrderDate and drop it on the axis.
03:09Access automatically changes this to OrderDate by month.
03:12It's grouping all of our orders together within a month.
03:14If I double-click on it, I can change the grouping level to, say, year or quarter.
03:19I am going to leave it on month and say OK.
03:23The Data section is where our orders are going to go.
03:25I will take OrderID, drag and drop it on the Data section.
03:29Access changes this to CountOfOrder.
03:30So it's going to count up the number of orders that follow in each month.
03:35Let's go ahead and say Next.
03:37Let's go ahead and give a title to our chart. I am going to call mine Number
03:40of Orders per Month.
03:42I can choose to display a legend or not.
03:43I am going to choose No legend, and go ahead and say Finish.
03:49Now Access populates a chart object into our form.
03:52But this graph actually has nothing to do with the data that we just gave it.
03:54It's just a placeholder image.
03:56Let's go ahead and switch into Form View to see the chart.
03:58I will switch into Form View here and Access looks like it's rendering the chart.
04:03Occasionally this doesn't render on screen properly.
04:06I found that if you just press the Refresh button here or try and change your
04:09view using the drop-down menu here, the chart will refresh.
04:13I will press the Refresh button here.
04:15And there's a basic chart. I leaves a lot to be desired, so we have got a lot
04:19of work ahead of us to format this properly.
04:21If charting is something that is very important to your organization, then I
04:25would recommend looking into some of the third-party charting add-ins that are
04:28available for Access.
04:29For now though, let's see what some of the capabilities are with the
04:32built-in charts.
Collapse this transcript
Linking controls
00:00Now that we've seen all of the controls that we have at our disposal when creating
00:03forms and reports, let's bring this full circle and piece a couple of them
00:07together to control the chart that we created in the last movie.
00:10Let's take a look at that chart here.
00:12I've got it saved as OrdersChart here as a form.
00:14If I double click on it, it will open the chart area, and again, you might have
00:18to refresh the screen in order to get the chart to draw.
00:20I'll click the refresh button and there's the chart.
00:23We can see that we have data from January 05 to July 2010.
00:28The data for this chart is coming from this query here called qry_OrderDates.
00:32I'll double-click on this query here to see the data.
00:35I've got 2200 records that are being pushed into the chart.
00:39Let's go ahead and close both of these.
00:43Now what I'd like to do is create a form that allows my end users to type in
00:47the date range that they are interested in, instead of viewing the entire date range.
00:50We can do that by going to Create tab and Form Design. That'll give us a blank
00:56form area where we can work.
00:58Now, there's a couple of ways that we can capture the information from our end users.
01:04I could just add in a Text Box and allow my end user to type in a date.
01:08But that doesn't really give them any sort of feedback as far as what dates are available.
01:12They might not know where the data starts and where it ends.
01:16Instead, we can go ahead and use a Combo Box.
01:18The Combo Box will allow them to choose from a list of dates that are present in
01:22the database. That way they know what's available to choose.
01:25I'll go ahead and click the Combo Box button and I'll add one into my form.
01:30Now, the Combo Box Wizard starts up, and I'll tell you upfront that the Combo
01:33Box Wizard isn't going to give as a result that we need, but we're going to go
01:36ahead and go through this wizard a little bit, and I'll show you why this isn't
01:39going to work for us.
01:40We're going to choose the, "I want the combo box to look up the values in a table or query."
01:44Let's go ahead and say Next.
01:47This table that we're pulling dates from is going to be our Orders table.
01:51So, I'll choose my Orders table and press Next.
01:53Here is the Date field, the OrderDate. I'll add that to my Selected Fields,
01:59because that's what I want to populate the list, and I'll say Next.
02:02Access will automatically sort them ascending, so I don't need to
02:05choose anything here.
02:06I'll say Next, and this is why the data's not going to work for us here.
02:10You can see that my OrderDates are listed multiple times.
02:12For instance, I had two orders on the 10th of January 2005 and three orders on
02:17the 12th of January 2005.
02:18I don't want these dates to show up multiple times in my list.
02:22We'll go ahead and cancel out of the Wizard to cancel all of this and move back
02:26to an Unbound Combo Box.
02:28Let's go ahead and attach the data source manually.
02:32I'll open up the Property Sheet and in the Data tab for the Combo Box,
02:37we're going to go to the Row Source.
02:38If I were to connect the Control Source to this Combo Box, it would automatically
02:43will be pulling data from a table and would feed data back into the table if
02:46we were to edit it.
02:47I don't want to interact with the table at all;
02:49I just want it to reference the table to populate the list that'll appear here.
02:52So instead, we're going to connect this to the Row Source, not the Control Source.
02:57I'll click on the Build button in the Row Source section and that will open up a query editor.
03:02This is an embedded query that's embedded inside of that form.
03:06I'll choose my Orders table here and say Add and Close, and then I'll
03:11double-click on OrderDate to add that to the query.
03:15I'll turn on my Totals row by pressing the sigma button up here that will turn on Total:
03:20Group By.
03:21Now, all the similar dates will group together into a single field.
03:25I'll click on Run, and I can see that I have 1350 individual dates that orders
03:31were placed on. Some might have multiple orders.
03:34Let's go ahead and close the query and I'll save the changes. And now this query
03:38is going to feed in what will appear into this Combo Box.
03:41I'm going to make it a little bit wider here and I'll change the label.
03:45I'll double-click on it and highlight it.
03:46And I'll change this to Start Date.
03:50Now I have a place where my end users can choose the date that they want
03:53the data to start at.
03:54I'll need a second copy of this in order for them to choose the date that they
03:57want the data to end at.
03:58I'm going to drag a box around both of these and then press Ctrl+C on the
04:03keyboard and then Ctrl+V to place a copy.
04:06I'll change the label here to End Date.
04:09Double click on it again and type in End.
04:12Now, I can go ahead and name both of these objects.
04:15I'm going to click on the Start Date Combo Box here and in the other tab I am
04:20going to find the Name property.
04:22Instead of Combo0, I'm going to change this to StartDate with no space and press Enter.
04:29I'm going to click on the Combo Box for our End Date, and I'll give it the name
04:34EndDate, with no space.
04:37Now, let's go ahead and save our form.
04:39I'll go up to the Save button or press Ctrl+S on the keyboard, and I'll name
04:43this form GrafDateRange.
04:44Now, there's one other property that I can add here for my End Date Combo Box.
04:49I can put in a Validation Rule that makes sure that the end user selects a date
04:53that's after what they've selected for Start Date.
04:55If I go into the Data tab,
04:58under Validation Rule I can click the Build button.
05:02This will bring up the Expression Builder and I can type in the expression
05:06"greater than" by pressing Shift+period.
05:08and then drill into my Forms > All Forms.
05:12I'll scroll down to find my GraphDateRange form that I'm working with and I'll
05:16find the StartDate field, and I'll double-click on it.
05:19So, now I've got an expression that says it must be greater than the StartDate field.
05:24Say OK.
05:26In our Validation text down here, there is an error message that'll pop-up if they pick a date
05:30that's before this date range.
05:32I'll type in, Please enter a date greater than the start date, and press Enter.
05:38Let's save our from again. Press Ctrl+S, and take a look at it in Form view.
05:42It's looking pretty good.
05:45I've some Combo Boxes here and I can select dates in.
05:47Let's go back into Design View and add one more element.
05:50Let me go ahead and click on this Button object.
05:53I'm going to create a button that will open up my form.
05:57I'll add that down here.
05:58I'll go to From Operations, Open Form, and the form I want to open is our Chart,
06:04I'll click on the OrdersChart. Say Next.
06:08Access then wants to know how we want the button to look.
06:10I can either choose a Picture or I can type in some text.
06:13And instead of OpenForm, I'm going to type in View Graph.
06:16Go ahead and say Finish and that'll populate my button.
06:20Switch back into Form View, and now the only thing left to do is to loop in
06:26my query into this.
06:27I got two boxes here.
06:29I've got Start Date and End Date.
06:31Now, I can open up my query.
06:34I'll switch into Design View and I'll use those Start Date and End Date boxes on
06:39my form to populate a criterion here in my query.
06:41I'm going to right-click in this criteria, under OrderDate.
06:45Right click and say Build.
06:49This will bring up the Expression Builder again.
06:51Now, I'm going to type in the expression "between" and I'm going to go into my
06:56Form > All Forms. I'll scroll down till I find the GraphDateRange form that we're
07:04working with and I'll say double click on StartDate.
07:06Then I'll type in the word "and" then I'll double click on EndDate.
07:12What I've just done is built an expression that says whatever dates are showing
07:15in the query must be between whatever I've selected on the form in the Start
07:20Date box and whatever I've selected on the form in the End Date box.
07:24We'll go ahead and say OK.
07:26I can go ahead and close and save my query, and I'll save my form again just for good measure.
07:33Now, we'll select a date in the Start Date box.
07:35For instance, I'll choose the 14th of January 2005 and I'll try and select an
07:40end date that's before that.
07:42I'll choose the 10th of January 2005.
07:45Access gives me a warning message.
07:46Please enter a date greater than the start date.
07:48Okay, I'll go back in, change my End Date to something greater.
07:52Let's choose 17th of January 2006, and I'll say View Graph.
08:00Again, I might have to refresh my graph, and now I've got a data range that runs
08:04from those two dates specified.
08:05I can close the chart here.
08:07I can select different dates here.
08:09For instance, I'll choose an End Date that's further in the future, View
08:16Graph, again refresh it, and now I've got a different graph with a different data range.
08:21So, how cool is that?
08:22Using a few simple objects, I was able to create a couple of selection Combo
08:27Boxes to choose options from.
08:28I press a button and instantly get a chart that meets my specifications.
08:32I can change my selections up as often as I want and get an endless number of
08:37charts that highlight exactly what I want to look at.
08:40Once you get comfortable working with each of the control objects available to
08:43you within Access, it's going to be up to you to be creative and figure out
08:47effective ways to hook each piece together to create your database application.
Collapse this transcript
4. Getting around the Database
Creating the main menu
00:00The forms that we've looked at so far in this course have all been linked to a data
00:04source and pulled records from our database tables.
00:06But forms don't always have to interact with data;
00:09they can be stand-alone elements that provide interactivity for our end users.
00:13In other words, a form can simply be a blank area where we can group buttons and
00:17capture user intent to help them navigate the database.
00:21When used appropriately, Navigation forms can completely remove any need for
00:25your users to dig around in the Navigation pane.
00:28You can control exactly what your users have access to and, often more
00:31importantly, what they don't have access to.
00:34In this movie we're going to create a main menu that'll help our end users
00:37navigate the Two Trees database.
00:39We'll start with a fresh, clean, blank form in Design View and add in some buttons
00:44that trigger macros.
00:45I'm going to go to the Create tab and create a new form in Design View.
00:48Now, let's go ahead and save this form right off the bat.
00:52I'll press Ctrl+S or you can use the icon in the top left corner, the little
00:55icon of a floppy disc.
00:57Press Ctrl+S and I'm going to call this Main Menu.
01:00Now first we need to set up the properties of our Main Menu form.
01:05I want this to be a free-floating window that appears in the center of the screen.
01:09And since I have to spend my day sitting in front of a computer working on
01:12this database all day, I want to make sure that I give myself a little bit
01:14of scenery to look at.
01:16In the Property Sheet for my form, I'll go to the All tab and I'll just scroll
01:22through this list and I'll change things as I see them.
01:25First, I want to change this Caption property.
01:27I'm going to change the Caption that will appear at the top of the menu to Main
01:31Menu with a space in it.
01:32Let's go down the list a little bit.
01:35I'll change the Pop Up property to Yes.
01:39Continuing down the form I'm just going to press the Tab key to move down here
01:42until I get to the Picture property.
01:44I want to add a background picture to my form.
01:46I'll choose the build button to choose a file from my computer and I'll browse
01:50to my Desktop into my Exercise folder into the Chapter 4 folder and I'm going
01:54to choose Ojai500x333.
01:57This is an image of where olives come from, the beautiful Ojai Valley in California.
02:01Go ahead and say OK.
02:04And that puts it into the background on the Detail section of my form.
02:07Let's go down a little bit.
02:08I'm going to press Tab to navigate through my Property Sheet some more.
02:11When I get to the Auto Center property I'm going to change that to Yes.
02:15My form is going to automatically center into the middle of the screen when it opens.
02:19Let's go down some more.
02:20I'm going to change Border Style and instead of being Sizable I want to say Thin.
02:26This will make the border really thin and not intrusive.
02:29Continuing down I'm going to go to Record Selectors.
02:31Record Selectors are that gray bar that appears on the left side of my form.
02:34Since this form isn't even connected to a data source, I don't need Record Selectors.
02:38I'm going to change this property to No.
02:41Navigation Buttons--again, those appear at the very bottom of the form.
02:43They'll let you page through forward and backward through your records.
02:47Again, there're no records here, I can easily say No to Navigation Buttons and
02:50get them off the screen.
02:51Let's skip down a little bit more until we get to the Scroll Bars property.
02:58Right now it's set to Both to show scroll bars in the vertical and horizontal axis.
03:02I'm going to change that to Neither.
03:04Let's go ahead and resize my form a little bit.
03:07The image that I chose in the background is 500 pixels wide.
03:10I want to make my Main Menu exactly the same size so that the image fully fills up the form.
03:15I can do that with this Width property here.
03:18Right now, it's set to 6.1694 inches.
03:21I can highlight that value and type in 500px. That stands for pixels.
03:26When I press Enter, Access converts that back into inches and it resizes my form
03:30so now it's exactly 500 pixels wide to match the background image.
03:34Now the Height property is a property of the Detail section.
03:37I want to make the Height match the image there as well.
03:39I am going to click on this background back here to select the Detail section.
03:44The Detail section Height property here is where I'll set the height.
03:48I'm going to change that to 333 pixels, again to match the image.
03:53Now, my image is exactly the same size as my form.
03:56Let's add a couple of elements to my form. Let's add a title here.
03:58I'll click on Label, click here in the form, and this is going to be my Main Menu.
04:05I'll type Two Trees Olive Oil Company and press Enter.
04:12I'll add one more label below it and I'm going to type in here Main Menu.
04:17Okay, I'll highlight both of these labels.
04:21I'm going to go ahead and align their text, so this is the right side of the
04:25bounding box and I'll switch the Arrange tab and align them right so they
04:30line up with each other.
04:31Switch back into the Design tab and I can change their Font and their Font Size.
04:35I'll go ahead and change the Font here.
04:38I'll scroll up the list till I find Arial Black.
04:40I'll go ahead and change the Size, maybe 12 points, and then I'll resize these
04:45boxes a little bit, so that it fits all of that text.
04:47I can also change the color of the font.
04:52Maybe I'll select my Font Color here and change it to? white probably
04:56won't show up very well, maybe?how about red?
05:02You can change whatever you like;
05:04these are really subjective changes that I'm making here.
05:06I'll move these up using my arrow keys to move it into the top corner, and
05:12there's the beginning of my Main Menu.
05:13Now let's add a couple of navigation buttons so I can navigate to other
05:16elements within my database.
05:18I'll go ahead and click on my button control, this Button button right here in
05:21the Design tab, and I'll click once in my Detail section of my form.
05:25That will start the Command Button Wizard, and I could choose what I want this button to do.
05:29Let's go ahead and say FormOperations, Open a Form.
05:35We'll say Next and I'll choose the EmployeeDirectory that we created earlier in this course.
05:40Let's say Next. I could choose how we want to display the form--to open the form
05:45to a specific data or to open the form and show all the records.
05:48Opening the form and showing all the records will be the same as double-clicking on
05:51it in the Navigation pane.
05:52Go and say Next. We can choose how we want the button to display, either with a
05:56photo or I could put Text. And we can be specific here. Instead of just opening a
06:01form, any form, we can we can specific in what form we're opening.
06:04I'm going to say View the Employee Directory and we'll say Finish.
06:11Now I've got a button on my Main Menu here that will take us directly to
06:15my Employee RibbonDirectory.
06:16Let's go ahead and move this over here to the left and we'll add another button below it.
06:21I'll go back up to my Design tab on the Ribbon, click on the Button control, and
06:26click to add a button again.
06:28This time we'll open up a different form.
06:30Let's go ahead and open up our product Reviews section that we created earlier.
06:33Again, I'll go to FormOperations, open a form, press Next. We'll choose the
06:40Reviews form, Next, go ahead and say show all records, Next. The text for this
06:48button will say Enter a Product Review.
06:51Go ahead and say Finish to add that button.
06:58Now I've got two buttons here.
06:59Let's go ahead and add one more button.
07:03Click on the Button control one more time.
07:04This time I'm going to add a button down here that closes the database.
07:09Click there, we'll go to Application and then choose the QuitApplication action.
07:14We'll go ahead and say Next.
07:16We can choose how we want the button to appear. Again I'm going to choose Text
07:21and I'm going to say Exit Database.
07:23Go ahead and say Next and Finish.
07:29Let's go ahead and take a look at how our form is working and see if all the buttons work.
07:33I'll switch into Form View and now I can see I've got a Main Menu; it's a
07:37free-floating screen here.
07:39I can click on View Employee Directory and it takes me to the EmployeeDirectory.
07:43Now we've got a little bit of an issue here because this Main Menu screen still
07:47stays on top of my Employee Directory.
07:49So let's go back and edit the macro a little bit to provide the
07:52better functionality.
07:53I'll go ahead and close the Employee Directory from the background.
07:57Select my Main Menu again.
07:59Because it's a free-floating window, I can't switch into Design View using the
08:02button up here on the Ribbon.
08:04I'll move down back into the Main Menu and I'll right-click here, and I can
08:07choose Design View from the pop-up list.
08:11Back in Design View I'll select my command button for the View
08:13Employee Directory.
08:14I'll click on the Event tab to take a look at its properties and I can see
08:18that the On Click event is set to this Embedded macro. That was created through the Wizard.
08:22If I click on the Build button to the right here, I can edit that macro.
08:26I'll press the Build button to jump into a macro editing session.
08:30Now I want this button to actually do two steps.
08:32Instead of just opening the form, the Employee Directory, I want it to actually
08:37close the Main Menu and then open the Employee Directory form.
08:41I'll click on the Record Selector here to the left of this first action and
08:45I'll choose Insert Rows.
08:47That'll insert an action row right before OpenForm, and I'll choose Close.
08:54With the Action Close here, Access is going to ask me for some arguments down
08:58below, the Object Type and the Object Name.
09:01I can choose that I want to close the Main Menu, which is a form.
09:04So for Object Type I'll select Form and then Object Name I'll choose MainMenu.
09:10Now I've got a button that runs a macro that runs two action steps.
09:15First, it's going to close the Main Menu form and then it's going to open up
09:18the Employee Directory.
09:19I can go ahead and close the macro to save it and say Yes to save changes.
09:24Let's go do the same thing for the Enter a Product Review form.
09:27Click on Enter a Product Review.
09:30On the Event tab, I'll edit the Embedded Macro.
09:33Pressing the build button, I'll add another line here, I'll click on the Record
09:38Selector and add Insert Rows.
09:41The Action again is going to be a Close action, so I'll type in close and press Enter.
09:45And down below, my Action Arguments, which form do I want to close?
09:49Well, I want to close that Main Menu form.
09:50So I'll select From and Main Menu.
09:55Close the macro and save the changes.
09:57And now my buttons do two steps. They'll close the Main Menu, and then they'll open
10:01their respective form. Go ahead and test that out.
10:03Go into Form View. Again I've got this free-floating window.
10:07I'll choose View Employee Directory.
10:09It's going to ask me if I want to save changes the first time, because I
10:13haven't saved the changes to this form. Go ahead and say Yes. It will close it
10:17and then open the Employee Directory.
10:19Now, I would need to provide some additional navigation to go from my Employee
10:23Directory back to the main menu.
10:24So let's add another button to my employee directory here.
10:28I'll switch into Design View, I'll take a button, and I'll add the button down here.
10:33We'll once again go to Form Operations, open a form, Next. This time we are
10:39going back to the Main Menu so I'll select it, Next, the Text will be Return to Main Menu.
10:51Next, and we'll finish accepting that default name.
10:55Once again though we want to close this form first, so we'll edit the Embedded Macro.
11:00We'll go to the Event tab, the On Click Embedded Macro, and build.
11:07We could have built this macro manually;
11:09we could also use the wizard to give us a start.
11:10There's lots of different ways that we could do this.
11:12This time I am going to right-click here and choose Insert Rows from the menu,
11:15instead of inserting a row up here from the Ribbon.
11:17So Insert Rows there, our Action is going to be Close.
11:23This time we can take a look at some of the hints here.
11:26The hint over here for the Close Action says Select the object type to close.
11:30Leave blank to select the active window.
11:33Since this button is actually being run directly on a form, we really don't even
11:37need to specify the action arguments about which form to close. If we leave it
11:40blank, it will close the Active form, which is the form that the button is on, so
11:44I'll just close it right here.
11:45Close, save my changes, and now I've got a button here that returns to the Main Menu.
11:51I'll close the Property Sheet and switch back into Form View.
11:57Now, I'll test out my button, return to Main Menu.
11:59Again it's going to ask me to save changes the first time. I'll say Yes, and now
12:04it takes me back to my Main Menu.
12:06Now I've got a navigation system to go from the Main Menu. I can go to View the
12:09Employee Directory and go back to the Main Menu when I'm done.
12:13The button down here will exit your database. It'll ask you to save changes if
12:16you press it, and there we go.
12:17As our database grows and we add functionality through other forms and reports
12:21and queries, we can return to this Main Menu form and add additional navigation
12:25buttons that'll get our users to where they need to go and back.
Collapse this transcript
Adding a splash screen with startup options
00:00A Splash Screen is a small window that displays when a program is loading, stays
00:04on the screen for a few seconds, and then disappears.
00:07You'll probably see the Microsoft Access Splash Screen every time you start the program.
00:11Adding a Splash Screen to your database and setting some startup options is a
00:14great way to create an engaging start up sequence.
00:17In the last movie we created this Main Menu form;
00:19we'll go ahead and double-click on it to open it.
00:21Now what I'd like to do is create a Splash Screen that opens up first when
00:25you open the database.
00:26After a few seconds it'll disappear and then the Main Menu will pop up.
00:30Now any time that I can reuse content that I have already created, I'm going to
00:34jump at that chance; it's going to save me time.
00:35So I'm going to go ahead and use this Main Menu as a basis and create a
00:39Splash Screen from it.
00:40Let's go ahead and close the Main Menu form and I am going to right-click on it
00:44in the navigation pane, and I'll say Copy.
00:46Then I'll right click on the navigation pane again and say Paste.
00:52Access is going to ask me what I want to name this new copy and I'll call it SplashScreen.
00:58and say OK.
00:59Now let's go ahead and edit this Splash Screen. I'll right-click on it in the
01:02navigation pane and jump directly to Design View.
01:05Now a Splash Screen is not going to have any buttons on it, so I can go ahead
01:09and highlight these and get rid of them.
01:10I'll drag a box around all three buttons and press Delete.
01:14Now I want to change some of the properties for my Splash Screen, so I'll make
01:17sure that my Form is selected in the Property Sheet, and again, if it's not
01:20open, you can press F4, Alt+ Enter, or use the button up here.
01:24I'll make sure Form is selected in the drop down menu and I'm going to go to the All tab.
01:29Now I can go through this list and change some of the properties.
01:33For the Caption, I don't want anything to display. I'm going to get rid of Main Menu here.
01:36I am going to go down until I get to the Picture property.
01:39Instead of the Ojai500x333 picture, I'm going to load a different one. Let's
01:44press the Build button, and I'll go to my Exercise Folder which is on the
01:48desktop. Inside of Chapter 4, and I want to choose this OliveSplash500x125 image. Say OK.
01:56Now I don't want it appear centered in the form like this, so the Picture
02:00Alignment property is currently set to Center. I'll change that to Top Left.
02:05That'll lock it to the top of my form.
02:06Let's go down a little bit further and I'll find the Border Style property.
02:11I'm going to change this from Thin to None, so there is no border whatsoever on my Splash Screen.
02:16Let's go ahead and change some of the properties for the Detail section of my form.
02:20I'll click anywhere on the form here. That'll select Detail, and it will jump to
02:24the Detail property sheet.
02:25Here I can set the Height to 2 inches. I'll type 2.
02:28I can change the Background color. Instead of being white down here, I'll press
02:33the Build button, and I'm going to select this Green 3 color chip.
02:38Okay, let's go ahead and move these labels down a little bit.
02:41I'll click and Shift+Click on both labels and then I'll drag them down to the bottom.
02:45Then I'll select anywhere else to deselect them.
02:49Now instead of Two Trees Olive Oil Company Main Menu, I want this to read Two
02:54Trees Olive Oil Company Access Database, so I'll double-click on Main Menu. I'll
02:58change this to Access Database.
03:00So there is my Splash Screen, I have got a couple more properties that I want to
03:06change that control its startup behavior. I'll go back to the Form properties by
03:10clicking this box up here, or changing if you're in the Main Menu.
03:14On the Event tab, it lists is all the different ways that you can add
03:17interactivity to the form.
03:18I'm going to scroll to bottom and find the On Timer event here.
03:24The On Timer event will automatically fire after a set interval that we'll type in
03:28here. Let's go ahead and build the Macro first.
03:32So for the On Timer event, I'll click on the Build button.
03:36Access is going to ask us which building method we like to construct our
03:39code. We could either use the Macro Builder, the Expression Builder, or if we know Visual Basic,
03:44we can jump to a Code Builder. I'm just going to choose the Macro Builder and
03:48say OK and now we can build our macro that's going to happen automatically.
03:53The first action is going to be Close.
03:56The action arguments, if you remember for the last movie, I can leave blank.
03:59It's going to close the active form which is going to be the Splash Screen.
04:03The next Action is going to be OpenForm. I'll press Tab. The action arguments for
04:09this are going to be which form I want to open, so I'll click in the Form Name
04:13Action Argument here, and way over here, I'll choose the MainMenu form.
04:17So we're going to Close the Splash Screen and then open the Main Menu.
04:22Let's go ahead and close this, and we will save changes to our macro, so now the
04:27On Timer macro has been built.
04:29Now I just need to specify the Timer Interval.
04:31The Timer Interval is a measurement in milliseconds, so in order to type in 3
04:35seconds, I need to type 3000, 3000 milliseconds. I'll press Enter to finalize
04:41that into the properties, and we'll go check it out and see if it's working.
04:44I'll switch into form view, and after about 3 seconds, Access is going to ask me
04:49to save this, because it is the first time it's being closed, so Yes, I'll save
04:52it, and my Main Menu opens.
04:54Let's close the Main Menu and try that again.
04:57Double-click on the Splash Screen, it appears centered in the screen, waits
05:00three seconds, it closes, and then the Main Menu opens.
05:03So the next thing I want to do is set my access database to start the Splash
05:08Screen when Access starts the program.
05:10I'm going to close Main Menu. And I'm going to go up to the Office button here and I'm going to
05:15go into Access Options.
05:18I'll click on the Current Database section, where I can change some of the
05:21properties for the current database.
05:23This display form property here, I'll change to automatically load my SplashScreen.
05:29So when I load this database in the future, the SplashScreen will automatically
05:32open, it'll wait 3 seconds, close, and then open up my Main Menu.
05:37I can change a couple of other properties here. For instance, I can change to
05:41display the navigation pane. I can turn that off if I want to keep people out
05:44of the navigation pane. Now go ahead and say OK.
05:48You must close and reopen the Current Database for the specified option to take effect. Okay.
05:52Now this is a good opportunity, we can go back to our Main Menu form and test
05:56out this Exit Database button.
05:57So I double-clicked on Main Menu and I'll press Exit Database.
06:00It's going to ask me if I want to save the contents of my Clipboard, and I can
06:05or can't. It doesn't really matter here.
06:07And now I'll open up this Exercise File again, the 4-2 SplashScreen. I'll
06:11double-click on it. You'll notice my navigation pane is gone. The Splash Screen popped
06:15up, waited a few moments, closed, and now my Main Menu is here.
06:20Now my end users have a really clean interface to move out of the database. I can
06:24view the Employee Directory.
06:25I can Return to the Main Menu.
06:27I can Enter a Product Review or I can finish my session and Exit the Database.
06:31One last thing before we go. I don't want the navigation pane over here being
06:35missing to make it feel like anything is secured in your database.
06:39The shortcut key for the navigation pane is F11.
06:41If I press F11, the navigation pane pops right back.
06:48So, this isn't a way to secure your database. It's just a way to keep things out of
06:51sight and possibly out of mind.
06:53Another way that you can get around the startup options. If I close this database again...
06:56If I hold down the Shift key while double- clicking on the file, Access will bypass
07:02all of the startup options, so it'll skip closing the navigation pane and it will skip
07:07opening the Splash Screen.
07:08So again, this isn't a way to secure your database in any sense, but it is a way
07:12to keep the interface clean for your end users.
07:14So a well-thought-out user interface is something your end users will appreciate.
07:18These little bits of polish and the details that you put in your database can
07:22take something that might otherwise just be a tool and make it something that
07:25people actually enjoy using.
Collapse this transcript
Creating a customer form
00:00So far we've taken a look at how we can create navigation forms to move around
00:04our database, we've created reference forms in our employee directory,
00:08and we've created a form that looks up orders that include a particular product.
00:11Let's now create a form that could be use to input records into our data tables.
00:15We'll create a form that can be used to use to capture information about our new
00:18customers and we'll make use of a property of the form called Data Entry.
00:23This time, instead of creating a form from scratch, we'll make a use of one of
00:26the shortcuts in Access and that's creating a form built off a table we have
00:29selected in our navigation pane. I'll go ahead and select our DirectCustomers
00:33table, go to the Create tab, and press Form.
00:36Now Access built us a quick form based off of our DirectCustomers table. If I
00:41scroll down we'll see that includes a subform down here, this gathering order information.
00:46We're going to use this as a basis for our form. We are going to get rid of the
00:49elements that we don't need.
00:50Let's go ahead and switch into Design View.
00:51I'm going to scroll to the bottom first and I'm going to get rid of that subreport.
00:57So I'll click on it once and press Delete. We'll scroll up to the top. We'll
01:01get rid of everything in the header section as well. I'll click on the title,
01:05delete it, click on the little icon and delete it, and I'll move this detail up to
01:09get rid of that header.
01:11Next I want to organize all of the fields that are on this form.
01:14I can select everything at once by pressing this button here, Select All, or
01:18pressing Ctrl+A. I'll select everything.
01:21I'll go into the Arrange tab, and I want to arrange everything to the Shortest.
01:26It's going to resize our elements so they all match the shortest element, which
01:29I believe is this Customer ID right here, so I'll press To Shortest and then
01:33they'll all get narrower.
01:34Now I'm going to scroll over to the right and I'm going to make these a little bit less wide.
01:37I'll select off of them once and then highlight these fields over here, so
01:41I'm not selecting the labels on the left. And once I get the a double headed
01:47arrow over here, I'll click once and drag them narrower, like that, and I'll
01:53make my form narrower as well. So I'll go over and drag the edge of the form
01:56over as well.
01:57Okay. Form is getting a little bit more manageable now. Let's go ahead and change
02:03these titles. Instead of just the field names that came directly out of the
02:05table, we're going to add spaces in between here.
02:08So instead CustID, all one word, I'll double-click once and then I'll add a space.
02:13I'll do the same for FirstName and LastName.
02:21Next, I want to change some of the properties of my form.
02:23So I'll make sure I'm selecting the form properties here by choosing the box
02:26between the two rulers. We're changing it here in the drop-down menu.
02:30We'll go to the Format tab first.
02:32The Caption for this is going to read, Add a new customer.
02:35We can also turn off our Record Selectors and Navigation Buttons as well.
02:42So Record Selectors: No. Navigation Buttons: No. Let's go ahead and change to our Data tab.
02:49On the Data tab, there is a property called Data Entry. It's currently set to No.
02:53The Data Entry set to No means that my form is going to be displaying data
02:58directly from my data table.
02:59If I change this to Yes, it's going to convert this into a data entry form,
03:03which will allow me to add one record at a time, so I'll change Data Entry to
03:07Yes. Let's now go to the Other tab.
03:09On the Other tab, I'm going to change this into a Pop Up form.
03:11We're going to change No to Yes.
03:14Let's go ahead and check out how our form is working.
03:16I'll click back on my form in the Detail section, go to the Design, and
03:20change the form view.
03:21So there is my Pop Up form.
03:24One of the things I see I need to change here is the height. It's pretty tall,
03:27But I do need to leave a little space here because I'm going to add some
03:30command buttons down below.
03:31But basically it gives me a blank slate to add a new record into my
03:35Direct Customers table.
03:36Let's go ahead and right-click anywhere in here and select Design View. And I am
03:43going to bring the bottom up, so I'm going to drag to the bottom, and I'll move
03:47this up here, but I'm still going to leave some space for my buttons.
03:49Okay, let's add a couple of navigation buttons. Click on the Button here, and we're
03:55going to add a button down there to the bottom.
03:58Now let me stop here for a moment and describe what these buttons are going to be doing.
04:02At this point we've turned our form into a data entry point.
04:05Values that we type into the text boxes are going to populate a new record into
04:09our Direct Customers table, but because Data Entry in Access gets saved on the
04:14fly, we need to be a little bit cautious in how we're handling this form, since
04:18there's no Save Changes when it comes to data entry.
04:21Simply closing the form commits any changes to the underlying data table, so
04:26when we close this form what we're really doing is saving changes to the data
04:29table and closing the form.
04:31If we simply want to back out of any data entry procedure, we first need to make
04:35sure these fields are clear of the values that might have been typed in before we closed the form.
04:39Let's create a couple of buttons that'll accomplish these tasks so that our
04:43end-users won't really have to worry about it.
04:45So we're going to add this first button. This first button is going to say
04:48Save Customer. We're going to go to choose the forms section, and we're going
04:53to choose Close Form.
04:55Closing the form is going to commit any changes that we have typed in here to
04:59the database while it closes.
05:01So simply closing the form will also accomplish the save task.
05:05So Close Form, say Next. I'm going to choose have my buttons display some text,
05:11but instead of closing form I want to be clear to my end-users what's about to
05:14happen, so I'm going to say Save Customer. That way it's super clear that when
05:19they press this button, they're committing those changes to the table.
05:21Let's go ahead and say Next, and I'll set that default name and say Finish.
05:27So there is my Save Customer button.
05:28I am going to add one more button in case they accidentally start typing things
05:31in and then decide they don't want to save that to the database.
05:35We'll go back up to the Button control and we'll add one more down below.
05:39This one is going to be a little bit more complicated in that we need the
05:42button to do two steps.
05:44First we want it to clear the records that we might have typed in, and then we
05:47want to close the form.
05:48So we're going to choose from these categories here. We're going to choose
05:52Record Operations and then Delete Record. Go ahead and say Next.
05:57The text on the button, I don't want it to say Delete Record, because that's a
06:00little bit confusing to our end-users. So what I want this to say is Cancel
06:04Entry. We'll go ahead and say Next and we'll say Finish.
06:10I need to go back and edit the macro this button is running;
06:13I need to add that second step.
06:15So while the button is still selected in my Property Sheet, I'll switch the Event
06:18tab and the On Click event has this embedded macro that we just built with the
06:23wizard. I'll click the Build button here. Access puts all of his error control
06:28stuff in here, but I just need to add one step.
06:31At the very end of all of this, we're going to also close the window, so at the
06:35bottom here into the Action column I'll type in Close.
06:40The action argument is going to ask me which Object Type and Name. Again, with
06:44the hint down here, I can leave this blank, and it'll close the active document
06:47or the form that it's run on.
06:49So I am just going to type in Close for the Action and then close the macro. It's going to
06:53ask me to save those changes and I'll save it.
06:56And now this button is running two steps.
06:58The first thing it's doing is clearing out anything that might have been typed in
07:01here, and then it's going to close the form.
07:02The Save Customer is just going to simply close the form and if we have data put
07:06in here, it is going to save that to the data table.
07:09Okay. Let's go ahead and test this out.
07:10I'll switch into form view. My form is here. I can close it. it's going to ask
07:15if I want to save changes, and I'll say Yes.
07:17Go ahead and save this as Add a new customer. That's a good name; I'll just take that.
07:22Now, let's go ahead and open it up again.
07:24I'll double-click on it, go ahead and type in a new customer ID. I'm going to
07:28type in 10000. We'll type a First Name of Adam and Last Name of Wilbert. Let's go
07:33ahead and save this customer and then go into my Direct Customers table to find that name.
07:38We'll scroll to the bottom of the list, or actually, we could just jump to the last
07:45record; it's probably easier than scrolling. And we'll see that new record has
07:48been added to the bottom here.
07:50Now in order to complete the circle, we could go back into the Main Menu and add
07:53a button here that jumps to the Add Customer Form. Let's go ahead and do that.
07:58I'll double-click to open up the Main Menu, and I'll switch into Design View.
08:02And that's going to actually switch into Design View of the table that I had
08:05opened in background.
08:06The Main Menu, as you remember, since it's afloating window, we actually have
08:09to right click on it here, and say Design View.
08:12So go into Design View, we'll add a New button, we'll add it to the bottom of
08:18the list here. This one is going to go to Form Operations, Open a Form, Next.
08:24It's going to open up the Add New Customer Form, Next, it'll show all the records, Next.
08:31The text is going to be Add a new customer. Go ahead and say Next and Finish.
08:39Last thing we need to do, you might remember we were going to edit this macro to
08:42also close the Main Menu, but since both the Main Menu and the Add Customer are
08:46both pop-up windows, we actually don't need to do that this time.
08:50So switch into Form View, we will test out our Add a new customer button, it
08:54pops up, allows us to enter any values, we can either Save those Changes or
08:58Cancel Entry. I'll click Cancel, and it takes us back to the Main Menu.
09:03Data Entry tasks don't have to be a chore. With a little thought into the layout
09:07of data entry forms, your end-users will be able to quickly and accurately
09:10capture the information that you need.
Collapse this transcript
5. Report Layout
Grouping and sorting data
00:00Access's way of preparing material and data for the printed page is through the report object.
00:05Reports take data from tables and queries, applies formatting, and organization
00:09roles, and bundles all of it together to documents that are ready to be sent to
00:13a printer or a PDF file.
00:15In this movie, we're going to take a look at how Access organizes data into
00:19grouping and sorting levels.
00:20Now, if you've ever used the Totals Row within a query, this is going to seem
00:24somewhat familiar as the concepts are really similar.
00:27Let's get away from the Olive Oil Company for just a moment, and open up a
00:30sample database that's all about playing cards.
00:32Now I've got a table here called Draw.
00:34I'm going to double-click on that and open it, and we can see that this table
00:36has 5000 records in it.
00:39This table represents 5000 random card pulls from a deck of playing cards.
00:43The first time I randomly drew a card, I had the 6 of hearts, the second time,
00:47the 4 of clubs, and I did this for 5000 times.
00:50Let's go ahead and close this table and we'll open up this query
00:54called DrawResults.
00:56The DrawResults query summarizes the Draw Table.
00:59It counts up the number of times each card appeared in my 5000 random pulls.
01:04The Queen of Diamonds, for example, showed up 121 times out of 5000. the 4 of
01:09clubs showed up 118 times out of 5000.
01:12This is the data that we're going to use to build a simple report.
01:15Let's go ahead and close this query.
01:16Now, we can create a simple report by going up to the Create button,
01:21making sure that we have something selected in the Navigation Pane, so I'm going
01:24to select this DrawResults, and then clicking on the Report button.
01:30Access will generate a basic report based off of the data of whatever was
01:33selected in the Navigation Pane.
01:34Now the default layout with all the records alphabetized doesn't really allow
01:38for a detailed understanding of our data.
01:40For instance, looking over this report, can you easily tell which card appeared
01:45most often, or how did the king of clubs rank out of all of the club cards?
01:50The report is not organized very well at the moment to help us answer these
01:53very basic questions.
01:54We can fix that using the grouping and sorting options to better organize this layout.
01:58You can find Grouping and Sorting underneath the Format Tab in the Report Layout Tools.
02:03I'll turn on Group & Sort and the panel will open up here at the bottom.
02:07Now, let's first add a sort.
02:09We're going to organize our data based off of the count. We'll add a sort.
02:15We'll choose CountOfID, and right now, it's set to smallest to largest.
02:19I'll change that by clicking the down arrow here to reverse it from largest to smallest.
02:24So now, I've got a simple sorting here, and I can tell the queen of diamonds
02:28with 121 pulls, was the most oftenly seen card.
02:31Let's go ahead and get rid of this sort, and we'll take a look at some grouping options.
02:36We can delete this sort by clicking on the X in the far-right side of this bar.
02:42Now, let's add a group.
02:43I'll click the Add a group button and this time we want to group all the
02:46like values together.
02:48In this case, let's group the cards together by their color.
02:50I'm going to click on SuitColor.
02:53Now, my records are organized into two groups.
02:55First, I have the black cards, the top, and if I scroll down through my report,
03:00I'll find the red cards.
03:02Let's add another grouping level to group by the suit.
03:04We'll add group, and this time we will check SuitName.
03:10Now, we've got our cards organized first by color, and then by suit.
03:14The order here is randomized still.
03:15So let's go ahead and add a sorting level to sort by the CountOfID now. Add a sort.
03:22Now we'll sort by CountOfID.
03:24We'll change it from smallest to largest to largest to smallest.
03:29Now our report has a much more useful layout that allows us to easily answer
03:32the questions about our data.
Collapse this transcript
Understanding report structure
00:00The structure that Access uses to assemble the reports on the page is kind of
00:04like building a layer cake or maybe even designing blueprints for a skyscraper.
00:08There are multiple sections that get designed one time each and then Access uses
00:12that blueprint over and over again as it needs each piece for the reports.
00:16Let's take a look at how this works.
00:18We're back in the Two Trees database and I've got a query here
00:21called OrdersByRegion.
00:22We'll go ahead and run that query.
00:25The OrdersByRegion query is summarizing and giving us an account of how many
00:29orders have been placed within each region and division of the company.
00:32Let's go ahead and close this query and we'll use that data table as a basis for our report.
00:39With the query still selected in the Navigation Pane, I'm going to go up to the Create
00:42Tab and click on this Report button in the Report section.
00:45That will create a basic report based off of that data.
00:49Let's take a look at this in Print Preview Mode, and dissect the
00:52different elements.
00:53We'll switch it here to View > Print Preview.
00:56Now, the report is made up of a bunch of different sections.
01:01At the very top of the first page, we have what's called the Report Header.
01:05The Report Header here includes the icon, the title, and today's date and time.
01:09The Report Header appears at the very top of the very first page of your report.
01:14The next element we have is what's called the Page Header.
01:16The Page Header appears at the top of every page.
01:19The Page Header for this report includes the Year, Region Name, Division Name,
01:23and CountOfOrderID fields.
01:25These are the headers for columns of data.
01:28Below that, I have the Detail section.
01:30The Detail section is each record of the report.
01:32So each line of this is one instance of a Detail section, and it's repeating for
01:37as many records as I have, all the way down to the page.
01:39When I get to the bottom of the page, I have the Page Footer section.
01:44The Page Footer section for this report is calculating and showing me what
01:47page number I'm on.
01:48Let's go ahead and change to page 2 using this Page Selector down here at the bottom.
01:52I'll click Next Page, and scroll back to the top.
01:55Now I'm at the top of the next page, I've got another instance of the page
02:00header again, followed by More Detail sections.
02:03And as I scroll down, I get to the end of the details.
02:06When I run out of things to report on, I've got what's called the Report Footer.
02:10The Report Footer for this report is calculating up the number of rows that I
02:13have, and if I scroll at the very bottom of the page, I've got another
02:16instance of the Page Footer.
02:18This is showing me I'm on page 2.
02:19Let's go ahead and take a look at what this looks like in Design View.
02:22I'll close the Print Preview window.
02:25It takes me back into Layout View.
02:27I'll go to the View Menu, and switch to Design View.
02:32This is the Design View of how that report was constructed.
02:35It's got sections for the Report Header, the Page Header, the Detail section,
02:40the Page Footer, and the Report Footer.
02:43Each element in the design of report should be as minimized as possible.
02:47For instance, if I take this Detail section and I make it a little bit taller by
02:50dragging down here, every time I have a row in my report, Access is also going
02:55to include all this white space.
02:56So let's take a look at what this report looks like now with that small change made.
02:59I'll go to the View Menu and click on Print Preview.
03:03I'll scroll back up to the top, and now my report is a lot different.
03:08It's got all this white space between each record.
03:10So a pretty small change repeated over and over again, has a big
03:13effect on our report.
03:14Let's close the Print Preview button, and that'll take us back to Design View. ARibbonnd
03:18I'll make this smaller again by clicking above the Page Footer and dragging back up.
03:23Now, in the last movie, we talked about grouping levels.
03:26When it comes to headers and footer sections, each grouping level can have its
03:29own header and footer.
03:30We can change the grouping in the Layout view like we did in the last movie or
03:35in Design View with the Group & Sort pane.
03:37My Group & Sort pane is already opened.
03:39If yours isn't, you can turn it on using the Group & Sort button here on the
03:42Grouping & Totals section of the Ribbon.
03:43I'll turn on there.
03:45Let's add a group on region name, and I'll switch into Layout View to take
03:49advantage of the fact that the Layout View will move my design around a little
03:52bit as I add a different group.
03:54I'll switch my View here to Layout View and add a group by region name.
04:02Access added a grouping name on region, and it moved the region name into the
04:06header for that section.
04:07Let's switch back into Design View to see what that change looked like there.
04:10The View dropdown menu, Design view.
04:13You can see I have a new RegionName Header here, and the RegionName moved up
04:17from the Detail section to the RegionName Header.
04:20Now, let's see this in Print Preview mode.
04:21Go to View > Print Preview and I see that the Region Name appears at the top of my data.
04:28Now as I scroll through here,
04:30when I run out of data for the Midwest, I start the Northeast region.
04:33And I have data for that. When I run out again, I get the South region, and so on.
04:38Now, as I scroll through my report, I lose sight of what the headers mean, so
04:41I'm not sure exactly what these columns mean.
04:43It would be nice, if I scroll back over the top here, to move Year, Division Name,
04:48and CountOfOrderID down from the Page Header Section into the header section for
04:53the region, so that every time I have a new region, I'd have another instance of
04:56those column headers.
04:57Let's go back into Design View and we'll make that change.
05:01Close Print Preview.
05:03Now it'll take us back to Design View.
05:04Now, when you create a report with Access's automated tools, it automatically
05:08groups all the elements together.
05:10Sometimes that makes it a little more difficult to manually move pieces around.
05:13So what I'm going to do is remove that grouping level, so that I can move pieces
05:17around to exactly where I want them.
05:18I am going to press Ctrl+A to select everything on my report.
05:22I can also use the Select All button which is right here in the Control section.
05:26I'll go to the Arrange Tab, and in the Control Layout section, I'll click on the Remove button.
05:30That will remove the grouping for each of these objects.
05:34Now, I'll just select any empty area to deselect everything.
05:37Now, I can move Year, Division Name, and CountOfOrderID--these are the column
05:41headers--down a level so they fall under RegionName Header.
05:45So every time I have a new region, I'll also get those labels.
05:48Click Year, and I'll Shift+Click Division Name, and CountOfOrder ID.
05:54Now I'll just move my cursor to the edge of the box, and I'll drag these down
05:56into the section below.
05:57Let's go ahead and take a look at our report now, see how that changed.
06:01We'll go to the Design View tab, where I can find my View Menu and Print Preview.
06:07Now I will scroll back up to the top.
06:09For every region, I've got a section with the column headers, and if I scroll
06:13down to the Northeast section, I've got the column headers again.
06:15Now, just like we have Report and Page Footers, we can also add a Footer section
06:20that will appear below the Region section.
06:22So after I run out of records for each region, we'll have a footer section
06:26before starting the next region.
06:27Let's do that in Design View.
06:28We'll close the Print Preview, and in Design View, in my Group & Sort section,
06:34where it has Group on RegionName, I'm going to click the More button here.
06:37Over here on the right side, it says, Without a Footer section and I'm going to
06:41change that to With a Footer section.
06:43While I am here, I can also change the Do not group together on one page, and
06:47I'll change this to Keep whole group together on one page.
06:51That way, as I get to the end of the page of my report, I won't have an
06:54abandoned header name with the details on the following page.
06:57So now I've got a RegionName Footer here that will fall at the end of the
07:02details for each region before starting the next region. Let's fill this with some content.
07:07Over here where it says with Year Totaled, I am going to click this downward
07:10arrow and I'm going to uncheck the Show Grand Total button.
07:13That will say with no totals now.
07:15I'll click off of the bar to finalize that, and now I can change it.
07:19Where it says no totals, I'll click the downward arrow, we'll Total On:
07:24CountOfOrderID, the Type, we will leave at Sum, so it will count up the number
07:28of orders within its region, and I'll show that in the Group Footer.
07:32We'll click on the checkbox there.
07:33You notice when I do that, it adds a calculated field here that says
07:37=Sum(CountOfOrderID).
07:39I'll click off the box here and one more time we'll look at this in
07:43Print Preview Mode.
07:44I'll change my View to Print Preview, scroll back up at the top.
07:49So I've got my header for the report, I've got the region.
07:53Within each region, I have these details for the years that were being
07:56reported on, and I have got a count of how many orders appeared in any
07:59region for the entire reporting period. And then I also have a count for
08:03each region for each year.
08:05You'll see the same header and footer options available to you when you're
08:08designing forms as well.
08:10But, they're really only applicable to forms set up with the continuous View
08:13property turned on like the employee directory that we created.
08:16So headers and footers are a little more limited value in forms, but they work the same way.
08:21In Reports, however, headers and footers coupled with grouping and sorting levels
08:25create the primary structure within which your data will be organized.
Collapse this transcript
Building reports from wizards
00:00Reports don't know anything about data, all a report knows is formatting.
00:04This font, this color, in this position, and that's it.
00:07For all of their data needs, reports rely on a data source.
00:11Data can come either directly from a table or a little more roundabout from a query.
00:16The nice thing about using a query as a Data Source is that you can bring in
00:19fields from multiple related tables, calculated fields, and expressions and give
00:24it all to the report in one nice and tidy package.
00:26When using a query, we have the option of using a pre-built query that you would
00:31find over here the Navigation Pane or by creating what's called an embedded
00:34query, directly inside of the report.
00:37Let's take a look at how our reports get data by having the Wizard walk us
00:40through the first few steps.
00:41I am going to go up to the Create tab here, and in the Report section click on Report Wizard.
00:47The Report Wizard starts and it looks a lot like the Query Wizard if you ever used that.
00:52And that's because essentially that's all we were doing here
00:53is creating a query to give the data to the report.
00:56Now we are going to work towards creating a report that takes a look at
00:58our customer's orders.
00:59I am going to choose from my drop-down menu, the Orders table.
01:04And from the orders table, I am going to use the OrderID, the OrderDate, the
01:09Customer ID and the ProductID.
01:12I want to find out some more information about my customers, so I will go back
01:15up here, scroll to the top to find my Direct Customers table and I will add
01:20FirstName, LastName, and State.
01:26Finally, I want to find out how much each customer has spent.
01:28And in order to get the price, I have to get that from the Products table.
01:32I will choose the Product's table,
01:34Price, and I will move that over as well.
01:37Once I have all of the fields selected, I will go ahead and press Next.
01:40The next screen is to ask, How do we want to view our data?
01:44This is similar to the form visit that we saw earlier, in that it will group by
01:47Products or Customers.
01:49I am going to choose by Orders and next, and now it asks if I want to add
01:54any grouping levels.
01:55I want to group my customers based off of the state.
01:58So I'll add that over there.
01:59Go ahead and say Next.
02:01We can sort our fields if we would like, I am just going to go ahead and accept
02:05the default and say Next.
02:07I will accept the default layout of Stepped and Portrait, Next, and I will choose
02:12the Access 2007 color scheme. Go ahead and say Next.
02:16What title would you like for your report?
02:18I want to go ahead and call this Customers by State.
02:21You can go ahead and press Finish to preview the report.
02:25This will open up the report in Print Preview mode and we can see that we have
02:31our Alaska customers first, and if the report was laid out okay, we'd find some
02:35data over here on the side.
02:36But unfortunately it's off the edge of the page. That's something we'll have to fix.
02:40Go ahead and close the Print Preview and that will take us back to Design
02:43View for this report.
02:46Now first I am going to fix that width.
02:48So I am going to go ahead and close my Property Sheet and I am going to move
02:50these fields around a little bit here. I have got this field here that's
02:53super narrow. I believe that's where my price is showing up. Yep, right there.
02:56So I am going to expand Price so I can see it.
03:00Now let's take a look at the Print Preview, changing my view to Print Preview.
03:04Now you can see the Price that the customers spent with the company.
03:07Let's go ahead and Close the Print Preview, and take us back into Report View.
03:12Now let's take a look at where the data is coming from, from this report.
03:15And we'll see what the Wizard created for us.
03:17I am going to open up the Property Sheet again, and once again my keyboard
03:20shortcut is F4, or Alt+Enter or you can press the Property Sheet button up here in the Ribbon.
03:25We'll switch to the Properties for the report.
03:27I can use the drop down menu here and choose Report or just like in forms, I can
03:32click on the black button between the rulers here.
03:34We are going to take a look at the Data tab for our report, and the Record
03:38Source. And we'll see that we have this Select statement here and this is a query
03:42that was built for us.
03:42We can click the Build button here on the right to take a look at the results of that query.
03:47I'll click on the b=Build button and we will see that this is the query that the
03:51Report Wizard was making for us.
03:53Now if you are familiar with queries in Access, this will look really familiar to you.
03:57If you haven't, I highly recommend the Access Queries in Depth course here at lynda.com.
04:01Queries and Reports really do go hand-in-hand, so knowing Queries will
04:05definitely help you out building your reports.
04:07Now one of the major downsides of the Report Wizard is it doesn't really allow
04:10for aggregation or summary data.
04:12You don't have that option to add up a customer's orders, for instance, to report
04:16on a Lifetime Spend amount.
04:18The Wizard simply returns straight records, and you can run this embedded query
04:22here by clicking the Run button, just like any other query, and it will show me
04:26the data table behind the query that that report is being built off of.
04:29Let's go back into Design View for the query.
04:32Now I can start editing this query if I'd like.
04:34But I have to warn you here, some of the fields within the report have already
04:38been linked to the fields here in the query.
04:39For instance, if I scroll over to the right here, I have got this field called Price.
04:44And if I now decided that I wanted to summarize based off of Price, and knowing a
04:48little bit about queries, I might go up here to the Totals row and turn that on.
04:52And then change Group By to Sum, and everything looks okay.
04:57If I press Run, I now get a summarized total for each customer.
05:00But the problem is that it's changed the header here to SumOfPrice.
05:04There is definitely work arounds, so you can work around this and fix this up to
05:08make sure there's no broken links between the query and the report, but it's
05:12going to take a lot of clicking.
05:13I am going to go ahead and back out of this query without saving these changes
05:18and I will say No here to that not save the change.
05:21And that will take me back to my report.
05:22So now that we know what powers the Record Source for our reports, we can
05:26smooth out our workflow by first creating a query that gathers exactly the
05:30information that we want, including aggregation and any calculations. Then build
05:34the report on that.
05:35This will be the topic of the next movie.
05:38And one last thing. The Record Source property in Reports functions exactly the
05:42same way when bringing data into a form.
05:44You can go back through some of the forms that we created throughout this course
05:48and explore the Record Source property to find out if we were using a table
05:51reference, a query reference, or an embedded query to generate those records.
05:55Of course with forms, you also have the option of having an unbound form that
06:00isn't connected to any data source, such as our splash screen or the main
06:04menu form that we made.
06:05Whereas a report will be kind of worthless if left unbound from a data source.
Collapse this transcript
Building reports from queries
00:00Building a report off of an existing query is probably the easiest way to get
00:04a great-looking report that displays some fairly complex information from your database.
00:09By leveraging the power of queries and feeding their results into the Reports
00:13Record source, you'll create a good foundation from which report design becomes
00:17just a matter of dragging and dropping fields into the appropriate locations.
00:20I said this before about Access, but sometimes all of the wizards and automated
00:25object creation features of the program can really get in the way and make things
00:28more confusing than they really are.
00:30Once you understand what's going on behind the scenes, it's often the case that
00:34hand-built, from the ground up, really is the way to go.
00:37For this exercise, I have gone ahead and pre-built a query called
00:41TotalSalesCustomers.
00:42Let's go ahead and open it up and take a look at it.
00:45This query takes each customer and finds their total lifetime spent with the
00:49company. We also have a field here that shows what state each customer lives in.
00:54Switching to Design View, by going to the View menu, Design View--and I'm going
01:00to close the Property Sheet here-- you can see how this query was built.
01:03I've got four different tables that are all related to each other. I'm pulling in
01:07the First and Last Name, the Lifetime Sales is being calculated or being totaled
01:12up, and I've got the StateName here.
01:15So this is what we're going to be using to build our report.
01:18Go ahead and close this query.
01:19I'm going to go to the Create menu and in the Reports section, I'm going to
01:24click on Report Design.
01:27This will give me a blank page and a fresh start.
01:29Now just like when working with forms, we want to connect this report to its data
01:33source and we do that in the Property Sheet here.
01:37I'll open the Property Sheet, and on the Data tab for my Report I'll choose my
01:41Record Source using the drop-down menu here and I'll choose that query that I
01:45just made, qry_TotalSalesCustomers.
01:49I'll go ahead and close the Property Sheet now and I'll take a look at our
01:52grouping and sorting options.
01:53I'll turn on Group & Sort, and I want to add a group to my report.
01:57We're going to group all of our customers based off of the state that they live in.
02:01I'll add a group and since we've linked this report to its data source, Access
02:05presents me with a list of fields that are available within that data source, so
02:08these are all the fields inside of the query.
02:10I am going to choose to Group on StateName.
02:13It adds a StateName Header here and if I scroll down, I'll see I have got a Page
02:19Footer here at the bottom.
02:20We will move this detail section up a little bit so I can fit it all on one
02:23screen. Maybe a little more here.
02:26Here we go. Okay. So that's the blank report.
02:31I've got my Page Header, the StateName Header that came from this grouping,
02:35the Detail section where I put my fields, and the Page Footer section down at the bottom.
02:40Let's go ahead and close the Sort & Group field. Close it there by clicking
02:43on the button again.
02:44Now I just need to drag and drop our fields from the Add Existing Fields window,
02:48and I will open that here, to the appropriate location, Report.
02:52I'm going to take the StateName field and drag and drop it into the StateName
02:57Header here. And then I'm going to take the other three--FirstName, LastName, and Lifetime Sales--
03:03and drop those into the Detail section.
03:05I can Shift+Click to select the whole range of them at once by clicking on
03:09the first and Shift+Clicking on the last, and I'll drag all three at once and
03:13drop them down here.
03:14Let's go ahead and arrange these around a little bit.
03:16The StateName, it's going to be obvious. I don't need a label here to tell me
03:20that this will be a state name, so I'm going to delete that label and I'll move
03:23the StateName over a little bit and make it wider.
03:28FirstName, LastName, and Lifetime Sales are going to be three columns, so I need
03:32to stack these next to each other.
03:34These labels here, I'm going to turn into field headers, and I'm going to put those
03:38up in the StateName Header section.
03:41I can do that, you would think, by taking one of these handles here that moves it
03:45independently of the object that it's attached to and maybe just dragging it up.
03:49But unfortunately when you get to the top of the Detail section it just stops,
03:52like it's hitting a brick wall.
03:54So what I can do is select each one of these together. I'm going to drag a box
03:57to select all three and I'm going to press Ctrl+X on my keyboard to cut them to the pasteboard.
04:03Now I'll come up into the Site Header section, I'll click in the StateName
04:07Header, click there in the Detail section, and press Ctrl+V to paste them in.
04:12Now I just move them around.
04:14So FirstName will go maybe here. LastName, how about there. And Lifetime Sales,
04:23we'll drag it out over to the right.
04:27I'll move this bar up here and then now I can align where my data will appear
04:31right below the headers.
04:33So the FirstName data will go below the FirstName header, the LastName data
04:39below LastName header, and Lifetime Sales will go right about there.
04:44Let's collapse my Detail section and take a look at the report.
04:48I'll go to the View menu and click into Print Preview mode. So there we are.
04:53I've got a basic report going, it's got my state names listed, and then within
04:58each state I've got the customer and the total lifetime spend.
05:03So this is a basic report, it's giving me the functionality that I need. It doesn't
05:06look very pretty though.
05:07So let's go back, change a few of the properties. We'll clean this up a little.
05:10I'll close my Print Preview window and I'll go up here to the Page Header
05:15section and I'll add a title.
05:17We will make this bigger.
05:19Using the Label here I'll drag out a box to add a title and I'm going to call
05:24this Lifetime Customer Spend.
05:30I'll change the size of the font here from 11 to let's say 18 and I'll move my
05:36StateName to a Font size of 14 and I will make it Bold. Drag that up here.
05:44I'll move my label here in the title to the left.
05:47Let's go ahead and turn on a couple of features in my Detail section.
05:50You click on the Details.
05:53In my Property Sheet here I'll go to the Format tab and I am going to change
05:57the Alternate Black Color here from No Color. I'll click the Build button and
06:02I'm going to choose this Green here, Green 2, so it will be the alternate color for that bar.
06:07I'll also change the background color of my Page Header here at the top.
06:10I'll click in the Page Header section.
06:12We'll change the background color from white, I'll click the Build button again,
06:17and I'll choose the darker green, Green 4.
06:20I'll click off of that to commit it, and we've made a couple of changes here to my report.
06:25Let's go ahead and take a look at those changes in Print Preview.
06:28And my report is starting to look a little bit better.
06:30I've got state name here.
06:31You can see these titles here.
06:34I might want to change the sorting order so that I'm sorting descending based off
06:38of the person having the most value, or the highest lifetime sales, so they
06:42appear at the top. And I could to do that in the Sort & Group section.
06:45So one more time I'll close the Print Preview, go back to Group & Sort, we're
06:49going to add a sort now by clicking on Sort.
06:53We want to sort on Lifetime Sales.
06:55I am going to change from smallest to largest to from largest to smallest.
07:00We'll close Group & Sort.
07:02I do want to make these a little bit more bold, click on each three of those, and
07:08say Bold and maybe Underline them then separate them a little.
07:11All right. Let's take a look.
07:14Report's looking pretty good.
07:15So with a little effort, we've already got a pretty respectable looking report.
07:19By starting from scratch we didn't have to tweak any of the pre-made pieces that
07:23the wizards tend to put in and we were able to make it to our specifications
07:27right from the start.
07:28In the next movie, we're going to continue building on this form by looking at the
07:31conditional formatting rules that we can establish.
Collapse this transcript
Formatting conditionally
00:00When skimming a long report, it can be pretty easy to skip right over some very
00:04significant numbers.
00:05By utilizing the Conditional Formatting rules within your reports you can make
00:09sure that the values that warrant a second look get noticed.
00:12We'll continue building on the Lifetime Spend Report from the last session.
00:15I am going to go ahead and open that here.
00:17Now let's say I wanted to highlight some values from my spending report.
00:20I want to highlight all the values that are below $20.
00:23We can do that with conditional formatting by changing our View to Design View
00:29and selecting the Lifetime Sales field here, and choosing Conditional Formatting
00:32in the Font section of the Design tab. I'll choose Conditional.
00:37Now in Condition I can do Field Value Is, instead of between, I'll change it to
00:43less than, and I'll say 20.
00:46If the Lifetime Sales is less than $20 then it'll format it by whatever values
00:51I've set here. I'm going to change this font to red and say OK.
00:57Let's go ahead and check out this change in Print Preview mode, and if I
01:01scroll down my list I can see a few people who have spent less than $20 with the company.
01:06Now let's say I wanted highlight this entire row, not just that number. I want
01:10to highlight the name as well.
01:11I can do that with the Conditional Formatting as well.
01:13We'll close the Print Preview and that will take us back into Design view.
01:17I'm going to select FirstName and Shift+Click on this LastName so that I
01:22can adjust the Conditional Formatting for both at the same time. I'll press
01:25the Conditional button.
01:28This time I can't really use the Field Value Is, because it's going to look
01:31for the Field Value of say the First Name or the Last Name.
01:35So if I were to compare the FirstName field to the value of 20, that's not
01:38something that's going to really make sense.
01:41What I need to do is change this to Expression Is, and we could type in an
01:45Expression that'll compare this field here, Lifetime Sales, to 20.
01:50So what I need to do is make in a field reference, and to do that I can use the
01:54square bracket and then type in Lifetime Sales, closing square bracket.
02:00Now I can compare this to 20. Is less than 20.
02:04So if the Lifetime Sales is less than 20, then the FirstName and LastName will
02:07get formatted as well.
02:09I'll change this to red and say OK.
02:13Now let's take a look at this in Print Preview.
02:17Now the entire row is highlighted red if the value in Lifetime Sales is less than 20.
02:21So using the Expression Builder and a bit of logical problem solving, the
02:25Conditional Formatting rules can highlight just about any records that you'd
02:28like to call special attention to.
Collapse this transcript
Calculating fields
00:00The data for your reports comes from the Record Source property, and it's linked
00:04to either a table, an embedded query or in the case of our LifetimeSpend report,
00:10from a linked query.
00:11We can actually calculate values right here in our report as well using
00:14Unbound text boxes.
00:16So we can bring in data that isn't in the Record Source.
00:19I'm going to double-click and open up my LifetimeSpend report that we've been working on.
00:23So far we've got some layout in and we've got some Conditional Formatting saved.
00:27Let's go ahead and change into Design View.
00:28What I would like to do now is add in another level of information to our report by
00:35summarizing data within each state.
00:37What I'd like to do is get a total count of how many customers we have in each
00:41state and the sum total of all of the sales within the state.
00:45To keep things clean, we'll add a State Footer and place all of our
00:48calculated fields there.
00:49We'll need to turn on our Group & Sort panel to add the footer.
00:52I'll go to my on Group StateName, the More section, and I'll turn without a
00:58footer to with a footer.
01:01That will add a StateName footer section here to the bottom.
01:04So after I run out of details for each state, we'll have a StateName Footer
01:08before starting the next state.
01:10Go ahead and close the Group & Sort panel, and I'll add in a couple of text
01:14boxes that we can program with some calculations.
01:16I'll click on the Text Box control up here in the Ribbon and I'll add one down
01:21into my StateName Footer.
01:22I'll go ahead and click another one and drop that down as well.
01:26So I'll have two text boxes. They are currently unbound so they're not connected
01:29to any data source, but they live now in my StateName Footer here.
01:33Now we need to create the calculations that will appear inside of these text boxes.
01:38Let's go ahead and open up our Property Sheet.
01:41And for this first text box here on the left side we're going to go to the Data tab.
01:45And in the Control Source section, normally we might choose a field from this
01:50drop-down menu, but I can actually use the build button to build a control.
01:54That's going to bring up the Expression Builder that will help us format our expression.
01:58We're going to choose to count up the FirstName of our customers to get a total count
02:02of how many customers are within each state.
02:04We'll go ahead and use the Count function and that we can find inside the
02:07Functions folder, Built-in Functions.
02:10If I scroll down the list here to SQL Aggregate, there is the Count function.
02:15I'll double-click on that to add it to the Expression.
02:17Now our Access wants to know, okay what are we going to count up?
02:20I'm going to click here in the middle and I'll give it a field that it can count.
02:24I'm going to go out to my Reports > All Reports, LifetimeSpend Report, and I want
02:31to count up the FirstName, I'll double- click on that to add at the expression
02:35up here on the top.
02:35Go ahead and say OK and the Control Source for my first calculated field is
02:40populated here in the Property Sheet.
02:42Let's go ahead and change the Text Box, so we know what this is counting.
02:47Change the Text here to Total Number of Customers.
02:49I'm going to move my site footer a little bit bigger so I have room to work.
02:55We can always collapse it back down again once you've moved everything into
02:57the correct position.
02:58And I am going to move these fields around using the handle to move them
03:02independently, the dark brown gray one at the top-left corner, and I'm going
03:07to move this calculated field underneath the label and I'll make it a little bit bigger.
03:12Okay, so that's our first box.
03:15Let's go ahead and calculate the second one.
03:16I'll click that Text Box and in the Control Source I'll press the build button again.
03:23That again brings up the Expression Builder.
03:25In this box we're going to take the sum total of the LifetimeSpend.
03:28Basically we want to find out the value that each State has brought to the company.
03:32We'll use this Sum function, which I could find in Functions > Built-in Functions.
03:37Scroll down to SQL Aggregate and Sum.
03:40What are we going to add up? I'll click in that box and then I'll choose the
03:45LifetimeSpend field from our report.
03:47We go into Reports > All Reports > LifetimeSpend Report, and I'll choose the
03:54Lifetime Sales field.
03:57Go ahead and say okay, and that adds the Expression to our Control Source here.
04:01Let's go ahead and rearrange the label again, so I'll drag this box over to here.
04:07I'll make the label bigger and for the label text, we're going to type in Total Sales.
04:14Okay, let's clean these up. Let's move them.
04:19I'm going to put Total Sales right below the Lifetime Sales, and I'll put Total
04:28Number of Customers below the customers here.
04:35Next I want to change the color of my site Footer to distinguish it from
04:38the Detail section.
04:39We'll go ahead and click in the site Footer background here, under Format;
04:44the Background Color is currently set to white.
04:46I'll click the build button and I'm going to choose a light green, this Green 2.
04:51Okay, let's go ahead and see how our report looks.
04:56I'll click on the View menu, Print Preview, and we'll scroll down until we
05:00get to the end of Alabama, and we've got these calculated fields here that are
05:03adding up the total dollars and counting up the total number of customers that
05:06we have in each state before starting the next state.
05:09So calculating controls are pretty straightforward, and the Expression
05:13Builder can help you construct the formula using any of the functions
05:15available within Access.
Collapse this transcript
Adding the finishing touches
00:00No report should be complete without those finishing touches that make it
00:03a polished document.
00:04Things such as page numbers, date and time stamps, and logos help present a
00:08professional looking report.
00:10In this movie we're going to finish up our Lifetime Sales Report by adding such elements.
00:14I'll double-click on the LifetimeSpend report here, and we'll switch into Design View.
00:19Now adding date and timestamps and page numbers is nothing more than adding an
00:26unbound text box with a calculated control source, just like we did in the last movie.
00:30We could add them manually and type in the expressions if we knew the proper
00:33syntax, but these finishing elements are so common that Access actually has
00:37buttons for these specifically built right into the Ribbon.
00:40For instance, I can click this button here on the top
00:42that says Title to add a title, and we've already added our own title using a label.
00:46I can click this button here that says Number, and that will insert a page number.
00:51And when I click on it, Access will open up this Page Numbers dialog box.
00:54We can format our pages;
00:56so for instance, I can just say what page we are on, or I can say what page we are
00:59on out of how many total pages in the report.
01:02Access will ask us where it wants to put it, either in the Page Header or in the Page Footer.
01:07I'll choose a Page Footer here.
01:09And now we can choose where we want to align this.
01:10Do I want to align to the center of the page, to the left, to the right, to the
01:15inside or outside margin, if you double siding?
01:17I am going to choose to the Right.
01:20Go ahead and say OK, and Access adds that calculated control down here in the
01:24Page Footer section.
01:25Let's go ahead and add a Date & Timestamp. That's this third button here
01:29on Controls Ribbon.
01:30I'll click that once. Another dialog box opens.
01:34We can choose to either Include a date or if I uncheck it, to not include the
01:38date, to Include the time, or if I uncheck it, to not include the time.
01:42Let's go ahead and put the date stamp on.
01:45We have some formatting options for how we want to format our date, and I am
01:48going to choose this middle one, and go ahead and say OK.
01:52Access adds that into the Report Header. It didn't actually give us a choice this time.
01:56And I'm going to go ahead and close the Property Sheet, so you can this date
01:59over here on the right.
02:00Okay, let's go ahead and see our report.
02:02I'll change into Print Preview mode. There we go.
02:07Our date is here at the top, we've got our title, and if we scroll to the
02:11bottom, I've got our page numbers.
02:13Let's add a logo to our report and clean up a couple of things that I'm
02:16noticing, for instance, these white text boxes back here, because of the colored
02:20background, it looks a little bit weird.
02:22I also want to add some lines to help clean up the report and separate the
02:25fields from one another.
02:26Go back into Design View by closing Print Preview.
02:32I'll add a logo to our report by pressing the Logo button here.
02:36I'll browse into my Exercise Folders on the desktop. Exercise Folders, we're
02:40in Chapter 5, and there's this TwoTrees logo, I'll say, OK.
02:44That's going to add it to the Report Header section, and I can go ahead and move
02:48our title up there as well.
02:49Now I'll reduce this a little bit, and I'll leave it as a green bar at the top of our report.
02:58Now let's change these boxes here. They currently have a white background, and
03:01I want to change them so they're transparent.
03:03I'll Shift+Click to select both of them, and I'll go up to the Fill bucket,
03:07right up here on the Ribbon, and I'll change that to Transparent.
03:11Finally, I want to add some dividing lines here.
03:13I can use a Line object. Here, I'll click the Line.
03:16I'll draw a dividing line across the bottom of my StateName Footer, and again when
03:22the line is horizontal,
03:23It's invisible, so it's there, you just can't see it. And I'll let it go.
03:28Now I can format my line, maybe I'll pick a solid line, about 2 points.
03:34I'll change its color here to this dark green color and I'll move the State
03:40Footer all the way up to that line.
03:41Let's take a look at our report now with those changes. Into Print Preview mode
03:47to see our final report.
03:48We've got a logo with a title.
03:50This dark green bar across the top, we have our state name, our fields here with
03:56our calculations and our Conditional Formatting.
03:59Then I finish with a dark green bar, and then we start with the next state name.
04:03We've got page numbers here at the bottom.
04:05So now that the report is finished, we can send it to the printer, save it as a
04:09PDF, e-mail it out, or simply save it in our database.
04:13Every time we open it, it will fetch the current snapshot of our business,
04:16updating each customer's spend, reevaluating the conditional formatting, and
04:20give us the up-to-date information in its presentation ready format.
Collapse this transcript
Populating pre-printed documents
00:00We have been hearing about the so-called paperless office for quite some time now.
00:04But that promise is yet to become a reality. There's just no getting away from
00:07having to fill in paper documents sometimes.
00:10Luckily, with a little planning and help from Access, we can streamline some of
00:14the process when it comes time to filling in preprinted paper documents and
00:18forms with information from our database.
00:21For this exercise, we'll look at populating information about our employees into
00:24a preformatted government employment form, such as this Form I-9.
00:28The first thing that we need is an image of our preprinted document.
00:31You can get the image in a number of ways;
00:33you can scan it in using a scanner or export it from a PDF file.
00:38However you do it, for the best printed quality, you should capture image at 300
00:42pixels per inch, and make sure that you are not scaling it.
00:45Next, we need to prep this image to overcome what I consider to be bit of a quirk in Access.
00:51In Access, you can't set page margins to zero, so if we import an image to a
00:56document that is exactly the same size as our printer paper, Access will try and
01:00wrap that image on to multiple pieces of paper.
01:03To overcome this, we need to crop our image down a quarter of an inch on all sides.
01:08So our final image will be 8.0 inches by 10.5 inches.
01:12At 300 ppi, this works out to exactly 2400 pixels by 3150 pixels.
01:20And then when we take that image and place it back inside of Access, it can
01:24accommodate the quarter-inch margin that Access has, and everything lines up just fine.
01:28Now if you need additional resources for getting your images prepared, you can
01:32check out a couple of courses at lynda.com.
01:34For instance, Scanning Techniques for Business and Home or Acrobat X tips
01:38and Tricks & Tricks.
01:39Now once we have our preprinted document image, it's time to get started in Access.
01:43So now that we are back in Access, we can go up to the Create tab here and
01:48start our I-9 Form.
01:49I am going to go to the Report Design.
01:53The first thing I want to do is setup the background of the report.
01:55I am going to get rid of the Page Headers here by right clicking on the Detail
01:59and saying Page Header/ Footer and turning that off.
02:02That will get rid of those.
02:03Then I want to double-check my Margins.
02:05I am going to go up to Page Setup, into the Margins section, and I just want to
02:10double-check that everything is set to a quarter-inch margin all the way around,
02:13and it is, so that's good.
02:15We'll return to the Design tab, and I am going to open up the Property Sheet.
02:20On the Property Sheet we'll go to the Format tab and we'll change a few of these
02:23properties, for instance, the Width.
02:25I am going to go ahead and change this to 8 inches.
02:29The image in the background can be set with a picture.
02:32We'll click here where it says none, and build, we'll browse to our Exercise
02:36Files, which are on my Desktop > Exercise Files > Chapter 5 folder, and it says i-9
02:45Cropped. Go ahead and say OK and that will add it into the background.
02:51Now we just need to change this Picture Size Mode from Clip to Zoom.
02:55Then we'll set the Height of our report and that's a property of the Detail section.
03:00So click on the Report down here, we'll set the height here to 10.5. Now
03:08everything is set up on the form properly and we can start adding our fields.
03:11I'll go to my Add Existing Field section and we'll browse into my Employees
03:15table and we can add all of the fields that we're going to be using on our form.
03:20So I'll take FirstName--and I'll just double-click on these as I go--LastName,
03:25Address, City, State, and Zip.
03:29We are also going to add MiddleName, but we'll have to treat that a little bit
03:32differently, because this particular form is asking for the Middle Initial, not
03:35the full middle name.
03:36But I'll double-click on MiddleName to add it.
03:39Okay, now that all the fields are in our form, I am going to first delete the
03:44labels here on the left side.
03:45Since we are putting this on a preprinted document, I don't need additional labels.
03:49So I'll drag a box to select all of them and press Delete.
03:51Then, I am going to change the color of these, so it's a little bit easier to
03:55follow on the screen.
03:56I am going to highlight all of these boxes, and I am going to go over here and
04:00I am going to change the Font Color to a bright red and I am going to make them Bold.
04:06Okay, now it's time to start moving things around.
04:08On my form, it goes Last Name, then First Name, then Middle Initial. So I'll start
04:12putting the fields in the right positions.
04:14I'll move LastName to here, FirstName will go next to it go over here and
04:22MiddleName will move over here.
04:26The address will go below all of that, and below that, City, State, and Zip.
04:32I can make a few of these wider, for instance, I think I'll need my cities to be wider;
04:45my Addresses definitely need to be wider.
04:47I can adjust this LastName and the FirstName boxes just to make sure they can
04:52accommodate all the data.
04:53Now let's go ahead and switch back to the Property Sheet and we'll deal with
04:55this MiddleName one.
04:56We'll go to the Property Sheet, and I'll click on MiddleName.
05:00I'll switch to the All tab, so I can see Name and Control Source together;
05:04usually they are on two different tabs.
05:05Now the problem is if I change the Control Source for this particular field here
05:10and make a reference to the MiddleName, the object is also named MiddleName.
05:14So Access will create a circular reference here.
05:17What I need to do first is change the name of this object and then I could
05:20change its Control Source.
05:22So instead of MiddleName, I'll call this MiddleInitial.
05:26And now I am free to change the Control Source to a formula.
05:29I am going to right-click here and say Zoom, to bring up the Zoom box so we can
05:33see what I am doing.
05:34I'll change the Font too, to make it a little bit bigger;
05:36I'll say OK to here.
05:37So the function that I am going to use is called Left.
05:42What Left does is it extracts characters from the left side of a string.
05:45So I am going to say equals left, and then open parentheses.
05:49I'll open a square bracket, and I'll close the square bracket around MiddleName.
05:55Now I need to tell the function how many characters to extract.
05:59I only want the first one, so I'll type in a comma and a one.
06:02I'll finish the function with a closing parentheses and we'll say OK.
06:05The last thing I want to do is make sure these boxes are transparent in the
06:09background and make sure they don't have any lines around the edges.
06:13So I'll highlight all of them, I'll change my Line Type here to Transparent, and
06:17I'll change my fill color over here to Transparent as well.
06:22Okay, let's go take a look at our form, I'll switch my View here into Print
06:25Preview and we'll see how the form is laid out and that data is populating in
06:30the correct position.
06:31Now on this screen here, this form doesn't look very good. It's hard to read, and
06:34that's just a resolution problem with the Print Preview View.
06:37For instance, if I zoom in here to 200%, you'll notice that the text becomes
06:42a lot more legible.
06:43Now we have two different options here as far as printing.
06:46We could just print this document as is and include the form and the data and
06:50print it all on a blank piece of paper.
06:52The other option is to go back into our Design View for the report and delete
06:56the image from the background.
06:57Then we'll just be printing the data on a page.
07:00We'll need to load the printer with the blank forms in order for it to print correctly.
07:03So adding a preprinted document into your Access database is an easy way to make
07:08use of the data that you already have and save you time.
Collapse this transcript
6. The User Experience
Printing reports
00:00We've seen the Print Preview screen many times throughout this course, but we
00:03have never really stopped to look at the Ribbon.
00:05Most of the Print Preview buttons would be pretty obvious in what they do.
00:08Let's go ahead and open up our LifetimeSpend report in Print Preview mode.
00:11I can go directly there by right clicking and saying Print Preview.
00:15Now along the top of the Ribbon, we have options to change the Size and change
00:19from Portrait to Landscape.
00:21Now these are decisions that might be better off made in Design View. For
00:25instance, if I change to landscape mode, you'll see that my report actually doesn't
00:28take any advantage of the extra space on the side.
00:30I'd have to go into Design View and reconfigure my report to take advantage of the new page.
00:35Let me go ahead and change that back to Portrait.
00:39Here, we have an option to change to a multi-column report.
00:42But again, this is something you would have to make a design decision on first,
00:45before you can properly take advantage of this.
00:47Here I have got a copy of my LifetimeSpend report that I have configured for columns.
00:51Let me right click on that and go to Design View.
00:54You can see that I have set the size to 4 inches wide.
00:56Now let's switch into Print Preview Mode and change it to a multi-column.
00:59I will go to the View menu and say Print Preview.
01:03Now I can go to this Columns button here and change it to 2 columns. I will
01:08leave the Column Spacing at a quarter inch, the Column Width is 4, and I am going
01:12to leave the Down and then Across option.
01:14Go ahead and say OK.
01:16This converts it into a two-column report.
01:18If I zoom out, you can see the full report here.
01:20Now the two-column report starts at the top on the left side, goes down to the
01:24bottom and then starts again at the top on the right side and goes to the bottom
01:27again before going to the second page.
01:30This might make your report a little bit more confusing to read.
01:32So you'd have to make a decision on whether this is appropriate for your data or not.
01:36Let's go ahead and close this one out.
01:39Over on the right side, we have some options to export our report.
01:42We can export it to an Excel file or a PDF file, a Word document, a Text file,
01:47and if I say More, I can choose to export it to other Database, a Snapshot file
01:53or maybe even a Word document.
01:55Now a lot of these export formats will remove any of the formatting that you put on there.
01:58So let's go ahead and say maybe Excel here.
02:01And we can go through the Wizard to export a file to Excel.
02:04I will go ahead and accept the default location here, but I will say Open the
02:07destination file after the export operation is complete.
02:10Go ahead and say OK.
02:13And Access exports that file to an Excel file and opens it up in Excel.
02:16When the report comes into Excel, I have lost all my coloring and font choices
02:21that I have made, but it looks like a basic report here.
02:23So I can work with the numbers in Excel.
02:25And in Excel, it actually even copies some of the formulas here.
02:28So if I click on this box down here 26D, you will notice that it also copies the
02:32formula which is adding up that column of data.
02:34Let's go ahead and then close Excel here, return back to Access.
02:39Technically, you can also print from a form.
02:41You won't find Print Preview in the Form menu for a form. For instance, if I
02:45go to this EmployeeDirectory here and right-click, I don't see Print Preview
02:48here, but there is nothing actually preventing you from printing it from the Office button.
02:52Let's go ahead and open that form.
02:54And if I go to the Office button, go to Print, and then Print Preview, it opens
03:00up in Print Preview just fine.
03:01In fact, this particular form would probably work out well printed.
03:05But that shouldn't be the primary use for forms.
03:07Reports are made to be printed and exported.
03:10You can use them as a screen-only presentation. That's really what forms are for.
03:14If I go back to my LifetimeSpend report here, and then close the Print Preview
03:19window, and then double click on it to open in Standard view, you notice that it
03:24just scrolls forever. It scrolls down and down and down, and that's not really a
03:28good user interface.
03:30The other thing that you can't do with a report on the screen is filter it.
03:33You will notice that the filtering options are grayed out.
03:35You will notice that if I close Print Preview for the form and then click on
03:38it to activate it, I will have some standard sorting and filtering that I
03:42can apply to my form.
03:43So if you stick to the rule that forms are for the screen and reports are for
03:47paper, you will be a much happier database designer.
Collapse this transcript
Tweaking the design
00:00At the end of Chapter 3, we took a look at connecting a user input form to a
00:04query, which then passed data into a chart.
00:07We can do the same thing with a report.
00:09I've got a workflow setup here called SalesByDivision and I'll double click on
00:12the form here to open it up and you'll notice that I have some selection boxes
00:16that I can put input into.
00:17I am going to go ahead and choose a few of these.
00:18I am going to choose New England for the Year 2005 and I want to compare that
00:23to values for the Mid-Atlantic in the same Year, in 2005.
00:27And if I say Preview Report, the report opens up and shows me the values
00:30that I've selected.
00:31I'll zoom in here and say Mid- Atlantic 2005 and there is those values, New
00:35England 2005 and here's those values, and at the very bottom of the report I have
00:41some grand totaling going on.
00:42Now, this form and this report have been refined to the point where they are very attractive.
00:47And I know that takes a lot of time going back and forth between Design View and
00:50Preview Mode to make sure that all of the changes that you're making are in line
00:54with the goals of the report.
00:55So let's dissect both of these elements to see how they were designed and some
00:59of the decisions that were made to get them to this point.
01:01We'll start where the user starts with the form, so I'll go ahead and close this report.
01:04Now the form here, I am going to switch into Design View by going to the View
01:09menu and changing it to Design.
01:10Now I want to take a look at some of the elements that are here on this form.
01:14It's actually a pretty simple form.
01:16First at the top, I've got this rectangle and I've colored it with the same
01:20color as the logo image that I've placed on top. The logo image is here.
01:25The image has this little bowl here that drops below this line of the rectangle
01:29and I've blended that into the background of the form by coloring the detail
01:33section to match the same color here.
01:35So when I view it in Form view, this all looks like one complete piece.
01:39In the bottom right corner, I've got this image of the tree.
01:42Again the background color of the tree is the same as the Detail section of the form.
01:46Another thing about this tree image, if I go to the Arrange menu up here and
01:50take a look at its Anchoring, you notice that the Anchoring of that image is to
01:54the Bottom Right of the form, so no matter what size of screen you're viewing
01:57this on, the tree will always appear in the Bottom Right corner.
01:59I have a label here that has the title and that's simply just colored white with
02:04a Font Size of 26, Bold and Centered.
02:07Then I have these elements here that the user interacts with.
02:11Let's go ahead and open up the Property Sheet, so we can take a look at those.
02:15These first two boxes populate values of our geographical division.
02:19If I look at the Row Source for those boxes, they are just standard combo
02:22boxes? If a look at the Row Source for these combo boxes I'll see that it's
02:27just this lookup here. I can click on it once and go to the builder to see the query behind it.
02:33These combo boxes are built with a query here that pulls from the States lookup
02:37table and it's showing the division name.
02:40I'm also using the ID number here to sort but I am not showing it in the drop-down box.
02:44The reason using I am using a DivisionID here... let me run this query here so we
02:47could see the results.
02:48It's so that these divisions don't show up in alphabetical order, but
02:52in geographical order.
02:54So they run from the East Coast to the West Coast, which is a much better
02:58ordering system than alphabetical for this list.
03:00Let's go ahead and close the query.
03:03So what happens with this data once I pick it from the list?
03:05If I go to the Other tab, we'll find the Name field here.
03:09The name of that box, this one here on the top, is cbo_division.
03:13I've also given a name to the one below it, cbo_CompDivision.
03:17I make use of these names in the query, and we'll take a look at that in a moment.
03:22I also have Year boxes here and if I click on that, those are named as well, so
03:26cbo_Year and the one below it is cbo_CompYear.
03:29If I look at the data for those, again the Row Source is built off of a query.
03:34I can review that query by clicking on the build button here and I can see that
03:38this is simply taking the OrderDate from the Order's table and it's applying the
03:44Year function to extract just the Year.
03:46So when I run it, I am just getting a list of the years that are present in my
03:50database. Go ahead and close that.
03:52The other two elements on this form are two command buttons, Preview Report and Run Query.
03:59Now both of these have an event associated with them, an On Click event, and if I
04:04click on the Run Query button and take a look at its event here by clicking on
04:08the build button, we'll see that it's just running an OpenQuery Action;
04:12it's such a single step action.
04:14The query that it's opening is this SalesByDivision-complete, and it's opening
04:18it in Datasheet View.
04:19You can close that.
04:22Let's take a look at what the other button does, Preview Report.
04:25Over here in the Property Sheet for the On Click event, the Embedded Macro,
04:29let's take a look at it by clicking the build button and we can see that this
04:33just runs one action as well, OpenReport.
04:36The arguments are down here, the report that it's opening is
04:38SalesByDivision.complete and it's opening it directly in the Print Preview mode.
04:42We could change this here using by using the drop-down menu to open it in a
04:45different View mode, for instance Design View or Report View or Layout View.
04:50We can even send it directly to a printer without any other interaction.
04:53So if I left it on Print here, as soon as I press that button, it's off to the printer.
04:57I am going to change that back to Print Preview and close the macro, and I am not
05:03going to save any changes here.
05:04Let's close the Property Sheet. So those are all of the elements on this form.
05:10Now they are aligned and they are kind of organized a little bit, so that it
05:13makes it clear for the end user that works top to bottom.
05:16But there is a really simple form;
05:18there is really not that many elements on it.
05:19Let's go ahead and close out the form and I am not going to save any changes
05:23that I might have made.
05:24Now let's take a look at that query real quick.
05:28I cover the query in Queries in Depth here at lynda.com, but I want to go ahead
05:32and run it just so we can see what it looks like.
05:34And I'll right click on it and say go into Design View.
05:38Now this particular query is pulling information from four tables, but we can
05:41see some criteria down here underneath the Year and DivisionName. And let me
05:45expand these boxes a little bit.
05:46They are actually quite long, so I am going to move it a little bit further here.
05:52And we can see that the criteria here is coming from the cbo_Year on the
05:58SalesByDivision form that we were just looking at. So this is one of those combo
06:01boxes that was selection for the Year.
06:04The criteria over here for DivisionName is coming from those combo boxes about
06:07the DivisionName, so it's pulling in whatever the user selects on that form and
06:11pasting it into the query.
06:12Let's go ahead and close the query and take a look at the report.
06:16We'll go to the Report here;
06:17I'll right click on it and go into Design View.
06:22Now this report, again, fairly simple. It's just organized in a nicely logical way.
06:27We've got a Report Header, a Division Header, a Year Header, a Detail section,
06:32a DivisionName Footer, and if I scroll down we've got a Page Footer and then a
06:37Report Footer here.
06:39The only coloring on this Report is here in the background in the Report Header,
06:43where I've got this light green color assigned to the background.
06:44I've got a couple of lines here on the report to help break up the space and
06:48they are a little bit hard to see because they are right at the edges, but there
06:51is a dark line here right below Division Header Name (DivisionName Header). You kind
06:54of see it if I click on it there.
06:56I also have a small line right below the word State here and Total Sales.
07:01So it's a small black line that you can kind of see right there.
07:04And in fact if I make this section a little bit bigger, if I drag it down, you
07:07can see that line is right there.
07:08So I am going to move that back up.
07:11The other thing I want to point out here is if I open up the Property Sheet,
07:14we've got some calculated fields. For instance I've got SumOfPrice here and
07:18if I look at the data for that, I can see that the Control Source is just SumOfPrice.
07:23So it's feeding in the SumOfPrice from the query.
07:26But below that in the DivisionName Footer, I've got some calculated fields that
07:30are taking all of the sums that show up in this Detail section. Remember this is
07:33going to appear over and over again for every record.
07:35If I click on this box here, the Division Sales, it's summing up or adding up
07:41all of the boxes that appear in this column.
07:43Let me scroll down to the bottom.
07:44I've got another one down here in the Report Footer and if I click on this one
07:49here, you notice that the Control Source of the calculation is exactly the same,
07:54it says =Sum([SumOfPrice]).
07:57The only difference between these two is that they are in different locations in the report.
08:00This one up here in the DivisionName Footer is adding up all of the prices in the division.
08:05The one down here in the report is adding up all of the values in the entire report.
08:10So the same calculation, but because they're in different locations, they are
08:13adding up different values.
08:15So let me go ahead and close these out, I'll run through the workflow once again
08:17just so we can see it in action, I'll close the Property Sheet, I'll close the
08:21Report, I won't save any changes here.
08:24We'll go back to the form and we'll fill in some different values.
08:28Let's say this time I am interested in looking at the South Atlantic States in
08:322005 and I want to compare those to the South Atlantic States in 2006.
08:35We'll preview the report and then I get the report for those values. And let's
08:41scroll up to the top here.
08:43Now the only thing different between this and some of the forms and reports that
08:46we've created in this course is the amount of time spent fine-tuning the
08:49position of the elements, adjusting colors and fonts, and I am going to admit it,
08:52sometimes obsessing over every pixel.
08:55Step one in creating your forms and reports should always be to get the
08:58functionality in place.
09:00Even if the form is completely and exceptionally ugly, once it functions
09:03properly, all the rest are just moving around pieces. And that part can take a
09:07while as you change your View mode back and forth between Design View, Layout
09:10View, Form or Report View, sometimes moving elements one step at a time.
09:15It can be tedious sometimes, but the end result will look great and
09:18function great.
Collapse this transcript
Automating the workflow with macros
00:00Before we wrap up this course, I thought it would be helpful to outline a
00:03couple of the Macros that you can build that will help you connect your form to your reports.
00:07As we've seen in several places throughout Access, sometimes the Wizards only
00:11present you with the most common options.
00:13To get access to all of the available options you need to dig into the designers.
00:17The same applies to the Button Wizard.
00:18I'm going to go ahead and open up our MainMenu form that we created earlier, I
00:21am going to right-click on that and say Design View.
00:24Now we've already created a couple of buttons on this MainMenu that connected to
00:28other forms, for instance, our View Employee Directory form, our Product Review
00:32form, or our new customer form.
00:34Let's add a couple more buttons that will connect it to other reports that
00:37we've made and then we'll organize this a little bit before we leave.
00:39I'll go up to the Button control on the Ribbon here and I'll click to add
00:43one button to my form.
00:45The Button Wizard starts and I'm going to choose Report Operations > Mail
00:49Report. Go ahead and say Next, I'm going to choose the Lifetime Spend Report,
00:54go ahead and say Next again.
00:56Access asks if we want to display a Text or a Picture. I'll put on the Text and
01:01I'll leave it as Mail Report for now.
01:03Go ahead and say Next and accept the default name, Finish.
01:07Access now created us a button called Mail Report that will e-mail the Lifetime
01:11Spend report, but I can get some additional functionality from that Macro by
01:14taking a look at its properties.
01:16So I'll make sure that the button is still selected, I'll go to my Property
01:19Sheet, and if it is not on you can toggle it on here.
01:22On the Event tab the On Click has this embedded macro that the Wizard created.
01:27We can edit this Macro using the build button on the far right.
01:30I'll click on that once and that will start the Macro editing session.
01:33The Macro created us this one action here, SendObject, and it attached this
01:38LifetimeSpend Report to it.
01:40But we have some additional options down here below that the Wizard
01:42didn't present to us.
01:43For instance, I can specify what Output Format, so I can specify here if I use
01:48the drop-down menu that I want to output this as a PDF file.
01:50I can tell it who I want to send it to, and I'll write test@test.com.
01:55I can specify Carbon copy or Blank carbon copy recipients;
02:00I can type in a subject line:
02:02Here is the report.
02:05I can go down and add Message Text to the body of the e-mail: The report is attached.
02:12And finally at the bottom, I've got an option that's called Edit Message and it's
02:15set to Yes right now.
02:16So when I click on that button what Access will do, it will take that report,
02:19this LifetimeSpend Report, it will convert it to a PDF file, but will then open
02:24up Outlook which happens to be the default e-mail program on this computer.
02:27It will create a new e-mail addressed to test@test.com, it'll put in the Subject
02:31line "Here is the report," it will put in the Message Text, "The report is attached,"
02:35and it will attach the PDF file to the e-mail.
02:38It will the sit there and wait for me to finally press the Send button.
02:42If I change Edit Message here to No and save this Macro, now if you click on
02:49that button you'll never actually even see the e-mail.
02:51Everything will happen in the background. The PDF will be created, the e-mail
02:54will be created, the file will be attached, it'll be addressed, and it'll be sent
02:58off without any further interaction on your part.
03:00Now I'm going to go ahead and set this to Yes and make sure I don't send any
03:03accidental e-mails here, let me close this Macro.
03:06I'll go ahead and save those changes.
03:09And now this button does something that's more specific than what the Button
03:12Wizard created for us in the first place.
03:14I am going to go ahead and change its name a little bit so it's not just Mail
03:16Report, which is a little generic.
03:17I'll go to the Format tab here and the Caption is currently set to Mail Report.
03:22I could be more specific and I'm going to change this caption to "email lifetime
03:26spend report" and go ahead and press Enter.
03:33Now I need to change the size of my button a little bit to accommodate all of
03:35the text, and I can move it down on my form.
03:42So there's one button; let's go ahead again and add another one.
03:44I'll go back up, click on Button control, and add it to my form.
03:48This time I am going to go to Report Operations > Send Report to File. Go
03:53ahead and say Next.
03:54This time I'm going to choose my CustomersbyState file. Say Next.
03:59I can choose Text again or a Picture. I'll choose the Text and say Next.
04:04I like to choose the Text option because it allows me to be specific about
04:08what this button is going to be doing.
04:09Icons can be a little bit vague sometimes.
04:11Go ahead and say Finish here, and now I've got a basic button that will export
04:15that report to a file.
04:17But just like with this Email button down below, there is actually a bunch more
04:20options that I can use by going into the Wizard, but just like the email
04:23button down below, I actually have a bunch more options that I can use by
04:27looking at the designer.
04:28I'll go into the Event tab, the On Click event. The Macro that's embedded here, I
04:33can edit it using the build button again. Build.
04:37The action that the Wizard created was Output 2, and is outputting the
04:41CustomersbyState Report.
04:43Now if I click that button right now Access is going to prompt me for a bunch
04:46of settings. It wants to know where to put the file and what kind of file to create.
04:50I can specify some of those right there.
04:53The Output Format, for instance, maybe I just want to export this is an Excel
04:56file every single time. I'll choose Excel.
04:58Output File location, I can specify a path so I can save it to my local
05:03computer in the same place every time, or I can save it onto a network drive if
05:07I want to archive it.
05:08If I specify a path here, Access will just automatically save an Excel file in that location.
05:13I can leave either of these blank;
05:15I'm going to leave the Output File location blank, but specify Excel.
05:18We'll go ahead and close this and save the changes.
05:22Now this button isn't just sending a report to a file but it's actually exporting
05:26a specific report to a specific file type.
05:28We'll go ahead and go back to our Format tab and change the name.
05:32I'll change the name to Export Customers to Excel, and again I'll change
05:42the size of my button.
05:42So now I've got a button, I am going to go ahead and go into Form View here
05:49and we'll test it out.
05:50If I click on it, it will export that report directly to an Excel file here,
05:54we'll specify that here, and then I'll tell it where I want to save it. Go ahead
05:58and say Cancel here.
05:59So now let's go ahead and organize our buttons a little bit on our form.
06:02I'll switch back into Design View and remember, since this is a floating menu, I
06:05can't change it here.
06:06I've got to right-click and go to Design View.
06:10Now, let's go ahead and organize these a little bit.
06:12I'm going to put them roughly in the order that I want and then I can go ahead
06:15and resize and arrange them so they're all aligned.
06:18First I want to take my employee directory and put that up in the top.
06:22My Add new customer and Export Customers to Excel kind of go together, so I'm
06:25going to put those together here.
06:26We'll have Enter a Product Review in the middle and then we'll put our lifetime
06:31spend reports below Customers, since that kind of goes with customers as well.
06:34I'll go ahead and highlight all of these to select them all at once and I'll go
06:38to the Arrange tab up at the top, and I'll choose this To Widest option and that
06:44will size all of the buttons to the same width.
06:47Now they're all the same width, I can align them all to the same edge by
06:50clicking left or right. I'll click Left and that will move them all to the same left edge.
06:56Now you can go ahead and space them by going up to the Equal Vertical alignment here.
07:01That will space all the buttons evenly.
07:03So there we go, let's go ahead and switch out of this, I'll go to the Design tab
07:07and change my Form View.
07:09And there are my buttons. They are all arranged nicely on the form, and they do
07:12different things when I click on them.
07:14So starting with the Wizard to create a basic Macro and then editing it to add
07:18additional options is a great way to add functionality and a finer level of
07:22control over your database.
Collapse this transcript
Conclusion
Next steps
00:00I want to thank you for joining me here in Access and I'd like to leave you with
00:03these parting thoughts.
00:04Form and Report design in Access is one of those areas that really
00:07is interdisciplinary.
00:09And you can pick up helpful ideas on how to structure your content in the most
00:12unexpected of places.
00:14Start paying close attention to the experience you have completing forms on the
00:17Internet or interacting with a screen on an ATM machine.
00:20If you find an unusually well laid out financial report, take a few minutes to
00:24pick it apart and figure out why it really works.
00:27Inspiration on how to create a better interactive experience for your end users
00:31literally is all around you.
00:32I'd like to recommend a couple of additional lynda.com courses that can help you
00:36build on the core concepts of user interface and would apply to what you've
00:40seen here in Access.
00:42The first is Web Form Design Best Practices.
00:44That course covers the importance of understanding user behavior and form organization.
00:48The second course is Typography for Web Designers, which explores the
00:52fundamentals of organizing text for increased clarity and organization.
00:56So until next time, thanks again and have a fantastic day.
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 New Features (36m 35s)
Alicia Katz Pollock

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


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