Image : http://www.flickr.com
Adding comments in your Access VBA application is very simple but requires a little effort and discipline. Comments are optional when writing code, but can be very useful when you have to consider it.
How do you program in VBA (Visual Basic for Applications) is written declarations. Access performs these statements when an event occurs. But the code without any comment is hard to read and very difficult to understand.
When you write code, everythingIt seems the logical and meaningful. However, when you should review your code for months or even years later, it is sometimes hard to remember what it is intended that the code should do. For example, it is hard coded some values into your application you may be wondering why you chose to use those particular values. Therefore, you write notes to remind yourself why you used the different parts of the code.
Also, if someone else needs to work with your code, would have appreciated a bit 'explanation of how exactly the procedures. For example, if you choose to leave your current job to take a new one. The company is working to hire another programmer, who then inherits the code. He might have trouble understanding your procedures. Of course, if you have ever had to consider another programmer 's code and found no comments, you' ll understand the importance of comments.
If you want to write VBA editor, comment lines, the first character ofeach line must be an apostrophe ('). The comment ends when you press ENTER to start a new line. You can type text on the same line, because they are ignored during code execution. They don 't slow down the program, so don' t be afraid to use a lot for their own benefit. To distinguish between the observations of executable code, Access will display the lines in green.
At least, you should write some comment in each step, explaining what they do and when it was written.
No comments:
Post a Comment