One of the most common questions you can ask about a data set is how many records it contains. In this video, learn how to count the records in a recordset.
- [Instructor] One of the most basic questions…you can ask about a table or other recordset,…is how many records there are within it.…In Access, you find that count…using the open recordset objects record count property.…I'll demonstrate how to invoke that property in this movie.…I've opened the course database…and I will press Alt + F11 to move over…to the Visual Basic editor.…I need a code module to hold my code…so I will click insert and then click module.…
Now I need to create a subroutine…that will call the code that I need.…I'll start typing Sub and then I'll call it RCount…followed by a left and right parentheses.…I'm not passing any arguments…so I don't need to have anything between the parentheses.…Press Enter a couple times to get End Sub…and some white space.…Now I can declare a variable to hold the recordset.…That'll be Dim…myR…as Recordset.…
Next I need to set the recordset…to a particular object in the database.…I'll type Set…myR…equals…CurrentDb,…that is the current database, .OpenRecordset.…Now I need to identify the recordset that I'm going to use.…
- Working with macros
- Running a VBA procedure
- Debugging VBA code
- Defining variables, constants, and calculations
- Displaying a calculated result in a message box
- Repeating tasks with loops
- Manipulating database objects
- Adding, editing, and deleting records
- Looking up values in a table
- Automating processes with macros
Skill Level Advanced
What you should know1m 38s
1. Introduction to Visual Basic for Applications
2. Define Variables, Constants, and Calculations
3. Add Logic to Your VBA Code
4. Debug Your VBA Code
5. Manipulate Database Objects Using DoCmd
6. Read and Manipulate Table Data
7. Manipulate a Database Using the Application Object
8. Control Forms and Reports Using the Me Object
9. Automate Processes Using Macros
Next steps1m 7s
- Mark as unwatched
- Mark all as unwatched
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.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.