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

Access 2010: Queries in Depth

Specifying a range of dates or times


From:

Access 2010: Queries in Depth

with Adam Wilbert

Video: Specifying a range of dates or times

Because Access stores dates as serial numbers, it becomes very easy to perform date comparisons or define ranges of dates. We've seen these comparison operators before, but I thought it would be valuable to review them and how they can be applied specifically to working with dates. We'll create a new query in Design view and we'll add a couple of tables. Let's grab our Customers table and our Orders table. Go ahead and close Show Table and we'll add some fields to our query. Let's add First and LastName and from the table Orders, we'll add OrderDate.
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

Watch this entire course now—plus get access to every course in the library. Each course includes high-quality videos taught by expert instructors.

Become a member
Please wait...
Access 2010: Queries in Depth
3h 2m Intermediate Jun 16, 2011

Viewers: in countries Watching now:

In this course, author Adam Wilbert illustrates how to create and leverage real-world queries and turn raw data into usable information. The course covers setting up queries, performing calculations, using the built-in Access functions to further refine query results, and identifying top performers or areas for improvement based on a range of criteria.

Topics include:
  • Naming conventions and best practices
  • Working with joins
  • Using comparison operators
  • Defining criteria for select queries
  • Creating parameter queries
  • Creating calculated fields
  • Working with dates and times
  • Using the Expression Builder
  • Creating conditional statements
  • Making, deleting and appending records
  • Building reports
Subjects:
Business Databases
Software:
Access Office
Author:
Adam Wilbert

Specifying a range of dates or times

Because Access stores dates as serial numbers, it becomes very easy to perform date comparisons or define ranges of dates. We've seen these comparison operators before, but I thought it would be valuable to review them and how they can be applied specifically to working with dates. We'll create a new query in Design view and we'll add a couple of tables. Let's grab our Customers table and our Orders table. Go ahead and close Show Table and we'll add some fields to our query. Let's add First and LastName and from the table Orders, we'll add OrderDate.

Now in our Criteria section, we can specify a date. Let's say we are only interested in records from May 12, 2010. 05/12/10. Let's go ahead and run this query and we get the two records that happened on that day. Back in Design view as you'll notice that Access wrapped our date around date delimiters or these hash-marks. Now Access is really flexible when it comes to dates. We can enter them in a variety of ways and it'll understand all of them. We can enter a 5-12-2010 and Access will understand that that's exactly the same thing.

If we go back to Design view, we can even type a date like this. May 12, 2010, and again Access says that's exactly the same thing. It understands all of those different formats. Let's go back into Design view. Now we can use comparison operators with our dates as well. For instance, if we're interested in all the records that happened after May 12th, we can use the greater than symbol, greater than May 12th, 2010. We'll run that and we'll see all the records that happened after May 12th.

Let's go back to Design view. we could also say greater than or equal to May 12th. This time it will return dates including May 12th and everything after. Let's go back to Design view and we'll apply some logical operators to our criteria. Let me go ahead and expand this a little bit so I have more room. After my statement greater than or equal to May 12, 2010, let's add another date to specify a range. And less than or equal to 5/30/2010.

Now we'll get a range of dates. Go ahead and run it. We'll see we have 21 records within that range. Notice that we're getting May 12 and May 30. So the greater than or equal to is inclusive. Let's go ahead and go back to Design view. Now rather than applying greater than or less than with dates, there are two functions that we can use specific for dates. That would be a Between statement. Here we can write Between 5/12 and 5/30. If we run that, we'll see we get the exact same number of records, 21, and it includes May 12 and May 30.

Finally, let's look at how we can apply a parameter request with dates. Let's go back into Design view and instead of supplying the dates hard-coded into our query, let's make this a parameter request so that the end user can supply the dates that they're interested in. We'll write it like this, Between, square bracket, Enter Start, closing square bracket, and then we'll write Enter End in square brackets.

to define the range. If we run this query, we'll get our Enter Parameter Value box where we can enter the start date. Remember, we can enter this in any format. I'll just say 5-12-10. Press Enter and I get the second box to ask me for the end date. Let's go ahead and enter this differently. May 30, 2010. Access returns the same records. So using dates and date ranges in a query's criteria field is a common way to return the most significant data or to limit the returns to only the most recent and relevant time periods.

There are currently no FAQs about Access 2010: Queries in Depth.

Share a link to this course
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.
Upgrade now


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.

Upgrade now

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
Welcome to the redesigned course page.

We’ve moved some things around, and now you can



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.

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