• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 26. Writing Visual Basic for App... > Exploring the Module Window

Exploring the Module Window

You write Access VBA functions and procedures in the Module window. To display a Module window, click the Module tab of the Database window, and then double-click the name of the module you want to display. To open a new Access VBA module, click the New button. A Module code-editing window appears, as shown in Figure 26.8. This figure shows part of the IsItAReplica() function of the Startup module that is included in Access 97's Northwind.mdb example database. You choose the function or procedure to display from the procedures drop-down list at the upper-right portion of the Module window. The Module window incorporates a text editor, similar to Windows Notepad, in which you type your Access VBA code. Access VBA color-codes keywords and comments.

The Access VBA code in Figure 26.8 demonstrates two principles of writing code in any language: adding comments that explain the purpose of the statements and using indentation to make your code more readable. Comments in Access VBA are preceded with an apostrophe ('); alternatively, use the prefix Rem (for "remark" in earlier versions of BASIC) to indicate that the text on the line is a comment. Rem must be the first statement on a line (unless preceded by a colon that separates statements), but the apostrophe prefix can be used anywhere in your code.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint