Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Building the form

From: Access 2010: Queries in Depth

Video: Building the form

The first step in creating a reporting tool is to build the form. Here is where the end user will input the parameters that they're interested in reviewing on the reports. Let's go ahead open up our Chapter 7 custom group and I'll open up the frm_Blank file that I've already started. This basically has some images and some color formatting already applied. Change this into Design View by clicking the Design View button here in the top, and we need to add a couple of drop- down menus for the user to select from. The first one will be the Geographic Division and the second one will be the Year.

Building the form

The first step in creating a reporting tool is to build the form. Here is where the end user will input the parameters that they're interested in reviewing on the reports. Let's go ahead open up our Chapter 7 custom group and I'll open up the frm_Blank file that I've already started. This basically has some images and some color formatting already applied. Change this into Design View by clicking the Design View button here in the top, and we need to add a couple of drop- down menus for the user to select from. The first one will be the Geographic Division and the second one will be the Year.

We can add combo boxes using this button up here in the Controls section of the Design Ribbon. We'll select Combo Box and add one to our form. This will open up the Combo Box Wizard and it presents us with two options. Neither of these options are going to be exactly what we're looking for, but we'll step through them a few steps and we'll see why neither of these will work. The first option is I want the combo box to get values from another table or query. I'll go ahead and say Next. I'm looking for the Geographical Division. We can get that from the States table.

I'll double-click on States. We'll add Division to our Selected Fields. We'll say Next. Let's go ahead and sort these Ascending by DivisionName, Next, and Access presents us with a table or a sample of what that drop-down menu might look like. Because each division could have multiple states associated with it, the drop-down list that Access generates with this method will have multiple divisions. We can scroll through the list and see East North Central is represented many times, and the same for each of the other divisions.

So this isn't the way we want our drop-down menu to look. Let's go ahead and back up all the way to the beginning. The other option says I will type in the values that I want. I go ahead and say Next. Access presents us with a blank table where we could type in just the values that we want. We could type in the values here, but this won't be linked to our data table, and if our company were to expand, say open up some international locations, those locations would not show up on the drop-down list unless we modify this list manually.

So this isn't really a good option either. Let's just go ahead and say Cancel to get out of the wizard altogether. A better option is to use an embedded query to link this combo box to. We can go into our Property Sheet for this combo box. We'll go to the Data tab, and under Row Source click in the empty field. We can use this button on the far right with the three dots on it to open up a query design window. From here we'll add our States table and close the Show Table window.

We'll add our DivisionName and we'll turn on our Totals row to group everything. Let's go ahead and view the results by clicking Run. And we see a data table that will represent the drop-down menu for our form and this is exactly how we want to format it. Let's go ahead and close the query. Access will ask if we want to save the statement and we do. And you can see that that SELECT statement has been populated into this Row Source column. I can right-click on it and say Zoom to open it up in the zoom window if I want to investigate it.

Let's go ahead and close that. So that's the drop-down menu for our Divisions. Let's add another one for our Year. Once again, go up to Combo Box, click once in the form, and we'll press Cancel to get out of the wizard. In the Property Sheet, go to Row Source and click on the Build button. For the Years, we'll look to our Orders table. We'll add that and say Close. Now we're not looking for the Order Date, because this is going to be a day-specific feature.

What we want is just the years that are represented by the dates, and we can use the Year function that we saw previously to do that. In this first field, let's right-click and go to our Zoom box. We'll type in the Year function and extract the year from the OrderDate field. year([OrderDate]). Let's go ahead and say OK and we'll turn on our Totals column to aggregate all those values together.

Clicking Run will show us the results, and that looks like what I expected. So we can go ahead and close this query. We'll save the changes and that has now been populated into the Row Source for this drop-down menu. Now let's clean up our form a little bit. I'm going to move the labels on top of the fields. So I'll click on the gray box at the top left corner of each label and I'll drag it to the top. And I know my Divisions are going to be a little bit long, so I need to make this wider, and I'll drag its label to the top as well.

Let's go ahead and rename these. This first one is Geographic Region. And the second one, if I double-click on it, is Year. So let's test this out and see where we're at. Let's change into Form view by clicking the button here on the View menu and we can see we have a drop-down list for our Geographic Region and a drop-down list for Year. Okay, so we need to copy these and add two more versions for our comparison data. One more time back into Design view. We'll highlight these two boxes, going to right-click, Copy, right-click again, and Paste.

Let's go ahead and drag these into position and I don't need the labels with these because they're already labeled above. So I will click on the label and delete it. Click on the Year label and delete that. And now we have our four drop-down menus to select Region, Year, and then our Comparison Region and Comparison Year. The last step is to name each of these boxes so they have a unique identifier that we can find later. We'll go into our Design view, we'll click on each drop-down menu, and switch to the Other tab, and we'll give it a unique name.

This first box we'll call cbo_region. The first Year we're going to call cbo_year, the Comparison Region we'll call cbo_compregion, and the Comparison Year we'll call cbo_comparisonyear.

Now each of these boxes has a unique name and we can identify that when we build our query. Now that our form is built and we've named the data collection points, we can start building the query and handle the end user's requests.

Show transcript

This video is part of

Image for Access 2010: Queries in Depth
Access 2010: Queries in Depth

46 video lessons · 13452 viewers

Adam Wilbert
Author

 
Expand all | Collapse all
  1. 9m 9s
    1. Welcome
      1m 10s
    2. Using the exercise files
      41s
    3. Introducing the database
      4m 29s
    4. Previewing the course
      2m 49s
  2. 17m 17s
    1. Understanding queries
      3m 31s
    2. Following naming conventions and best practices
      2m 56s
    3. Using the Query Wizard
      5m 21s
    4. Exploring the design interface
      5m 29s
  3. 26m 39s
    1. Defining criteria
      5m 40s
    2. Understanding comparison operators
      3m 19s
    3. Defining the column headers
      2m 49s
    4. Exploring the property sheet
      7m 32s
    5. Printing query results
      2m 41s
    6. Working with joins
      4m 38s
  4. 14m 14s
    1. Understanding parameter queries
      4m 27s
    2. Obtaining parameters from forms
      5m 17s
    3. Creating a combo box
      4m 30s
  5. 23m 24s
    1. Understanding the Totals field
      5m 31s
    2. Creating aggregate calculations
      3m 31s
    3. Exploring the Expression Builder interface
      4m 28s
    4. Using mathematical operators
      5m 46s
    5. Applying text functions
      4m 8s
  6. 24m 23s
    1. Understanding dates as serial numbers
      2m 42s
    2. Specifying a range of dates or times
      3m 47s
    3. Formatting dates
      4m 31s
    4. Using other Date/Time functions
      3m 47s
    5. Defining today's date
      2m 41s
    6. Calculating time intervals
      6m 55s
  7. 20m 9s
    1. Introducing the conditional IIf function
      2m 57s
    2. Creating an IIf function
      7m 31s
    3. Nesting IIf functions
      4m 57s
    4. Using the Switch function
      4m 44s
  8. 20m 41s
    1. Understanding the reporting tool
      2m 13s
    2. Building the form
      6m 57s
    3. Building the query
      5m 4s
    4. Building the report
      3m 30s
    5. Finalizing the reporting tool
      2m 57s
  9. 25m 37s
    1. Finding duplicate records
      2m 17s
    2. Identifying unmatched records
      2m 29s
    3. Creating crosstab results
      2m 57s
    4. Creating backups
      1m 29s
    5. Creating update queries
      3m 22s
    6. Making, deleting, and appending records
      5m 36s
    7. Uniting tables
      3m 16s
    8. Embedding SQL code in queries
      4m 11s
  10. 1m 0s
    1. Next Steps
      1m 0s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now "Already a member? Log in

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Access 2010: Queries in Depth.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

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.

Sign up and receive emails about lynda.com and our online training library:

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

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.