Honor Thy Parens and Quotation Marks

Punctuation marks count big time in all programming languages. Many come in pairs. For example, you will never find a VBA function or statement that uses only one parenthesis. For every open parenthesis, there must be exactly one closed parenthesis.

You can do yourself a favor by getting in the habit of always typing both punctuation marks immediately when you know that two are required. For example, when you have to type something like IsNullQLast Name]), you can type it like a programmer rather than like a normal person. Here's how a programmer would type that. First type

IsNull()

The syntax of IsNull() requires both parentheses, so now both parentheses are typed. If you don't type both parentheses when you're thinking about them, you'll probably forget to type the closing parenthesis later. (Compile error!)

Next, a programmer would type the square brackets inside the parentheses, like this:

Once again, if you type the opening bracket, you know you're gonna need a closing bracket, so just type it while it's fresh in your mind. Finally, type the thing in the middle of it all:

IsNull([Last Name])

The same goes for quotation marks. For example, to type MyText = "Hello World", first type

You can't forget to type the closing quotation mark now because it's already there. Then type the stuff that goes inside the quotation marks:

MyText = "Hello World"

The abbreviated version of the Fourth Commandment is Thou shalt not type like a normal person.

0 0

Post a comment