From the course: Access 2016: Queries

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Pull random records from the database

Pull random records from the database

From the course: Access 2016: Queries

Start my 1-month free trial

Pull random records from the database

- [Voiceover] Occasionally, you'll wanna do a spot check or perform an audit on the data that's in your database. And while you don't want or don't need to review every single record, it would make sense to review a random sampling of the information that you're storing. Let's suppose you needed to do a customer survey of 50 customers, and you wanted to be sure to get a random customer sampling to call so you don't introduce bias into the survey results. Here's how you can have Access pull up the records for you. We'll start with a new query in Design view, and I'll add in my Customers table. Then we're gonna choose the CustomerID, FirstName, LastName, and Phone number fields. In the fifth column, I'm gonna right-click and choose Build to go to the Expression Builder. We'll go into our Functions, into the functions built into Access, then we'll come down to the Math category here. There's a function called Random, or Rnd, and if I take a look at the syntax down here, we can see that…

Contents