Watching a value in a routine displays a variable's contents while the code is stopped at a breakpoint. In this video, learn how to watch a value in a routine.
- [Instructor] When you create a subroutine,…that contains a for next or do loop,…you might encounter situations where your code…return an unexpected value.…Rather than create a series of message boxes…or print values to the immediate window,…you can create a watch that displays the value…of a variable continuously.…You can hopefully use a watch in combination…with break points to find out where the error occurs.…I'll demonstrate how to use watches and break points…together in this movie.…I have opened the course database…and I'll press alt F11 to open the Visual Basic editor.…
I need a code module to work in,…so I'll click the insert menu header, click module,…and there is my code module.…I'll create a subroutine, so I'll type sub,…count, quantity.…I won't pass any arguments so I'll just type…a left and right parentheses and enter,…so I have a little bit of room to work.…First I'll declare my variables, so that'll be dim…L-N-G count as long, then a comma,…and my R as record set.…
The L-N-G count variable will keep track of the quantity…
- 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.