
|
Access in-line code
As you probably know, it's good practice to add comments, notes, and explanations to your code. Other users can then easily understand the purpose and logic of the code when they read it. In addition to the commonly used apostrophe ('), a little known feature is that Access allows you to use REM and line numbers to document code. This is particularly nice for old-school programmers that have spent years writing in DOS and BASIC! As with the apostrophe, REM statements can be on their own line or at the end of a line of code. Line numbers also help document your code. Line numbers especially help when troubleshooting code with another person. The numbers consist only of digits, must be in the leftmost column of your code, and must be unique within the module. Note that you can't use line numbers with beginning or ending Sub statements.
Line numbers 1 Dim x As Integer 10 For x=1 to 10 20 Debug.Print "Hello World" 30 Next x
|
||||
| Search RD Techbase | ||||
![]()