Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
When you read about VBA programming you might see the writers refer to subroutines and functions. Even though some authors use the two terms synonymously, they actually mean different things. The generic name for both subroutines and functions is a procedure. To demonstrate how to create the subroutine, I'll press Alt+F11 to open up the Visual Basic Editor and then click Insert > Module. You create a subroutine by opening a code module and then typing Sub, then a space, and then the subroutine's name.
The subroutine's name can have no internal spaces, and it has to start with a letter. So in this case I will make it Welcome, then type left and right parenthesis--in this case with nothing between them--and then press Enter. When you press, Enter Access creates the subroutine, adds an End Sub statement, and gives you a blank line where you can start typing your code. In this case, I'll have a display or message box that says, "Welcome to the Shipment Tracking database." So MsgBox and don't worry; we'll cover message boxes later. Then the space, left parenthesis, double quotes, and then I'll just type in "Welcome to the Shipment Tracking database," then a period, and double quotes, and a right parenthesis.
Now when I press F5 Access runs the macro and displays my message box. Subroutines are the backbone of Access programming. You use them to manipulate database objects and add functionality for your users.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 97566 Viewers
80 Video lessons · 141073 Viewers
59 Video lessons · 59423 Viewers
52 Video lessons · 72747 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
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.