comment out code

G

Guest

Real quick question:

Is there a way in Access to comment out blocks of code rather than the ' on
each individual row?
Thanks
 
6

'69 Camaro

Hi, Sam.
Is there a way in Access to comment out blocks of code rather than the ' on
each individual row?

Yes. See the tip "Four very useful toolbar buttons for the VB Editor" by
Tom Wickerath, on the following Web page:

http://www.Access.QBuilt.com/html/gem_tips.html#ToolbarBtns

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)
 
A

Albert D. Kallal

smk23 said:
Real quick question:

Is there a way in Access to comment out blocks of code rather than the '
on
each individual row?
Thanks
--

There is no "comment" a block feature that many programming languages have.
So, the only way is to use a ' at the start of each line.

(there certainly is a button in the VBA editor that when clicked it will
place ' on a block at code in one click, but this is certainly a different
feature then a start/end means to comment out code...).

However, you can actually use complier directives, and do the following:

#If True = False Then


#End If

Note the use of #. The above expression means that any code included
between the #if True = False then, and the #End If will be skipped during
compile. This means also that when you compile the code down to a mde..the
above will not be included in the object file, and thus will be smaller in
size then if you used:

If True = False Then


end if

The other advantage of the "#if" compared to "if" is that this really does
behave like a commented out block of code since you can have compile errors
in that code block..but since the block is ignored by the compiler, it
essentially is the same concept of commenting out a block of code that many
IDE's have.

Normally, conditional compiling is used for version dependent features. (for
example, access97 does not have a split command..but a2000 does). So, you
could setup a constant for your version number..and have different code run
depending on what platform your target audience is going to be.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top