You insert VBA commands by typing them into the appropriate place in the Module window. This, of course, requires some knowledge of VBA. Access provides online Help to assist you in writing VBA code. The Visual Basic Editor also helps you with hints that help you complete a command accurately. If you have entered a command incorrectly, the Editor notifies you of the error and may suggest ways of correcting the problem. One of the most useful VBA objects you'll encounter in writing VBA code is the DoCmd object, which represents Access commands. You can use DoCmd in your commands to perform basic operations, like opening tables, reports , and forms.
Write a VBA Command to Open a Table