Although we're not going to use the wizard generated code "as is", this is as close as Access comes to providing a Record New Macro function so select the Record Operations category and Add New Record action and click the Finish button. If you open the Visual Basic editor now, you will see that Access has generated a subroutine in the form that is mostly error handling, but has one other line of code:
~~~~~~~~~~~~~~~~~~~~~~~~~
DoCmd.GoToRecord , , acNewRec
~~~~~~~~~~~~~~~~~~~~~~~~~
The dot suggests that DoCmd is an object and GoToRecord is a method. acNewRec is an argument that further defines what the GoToRecord method does. This type of coding goes back to Access 95 and it's still used in Access 2002. So we're going to "piggyback" on it and just let it do what it does.
This is the main area where experienced Access programmers will object that there are more advanced ways to do it (and they're right). More advanced applications will declare database, query definition, recordset, connection, and other types of objects that make up the different access methods available. After you're comfortable with VBA, I recommend that you learn about these techniques and use them.
With our 'database' statement written for us, it's time to write the code to bring in our Word data. I created a Word document with a verse from a Lewis Carroll poem. The code to retrieve the lines of the verse are quite similar to what we have done before. The next page shows the code.


