how to add comments to SQL in Access

A

asc4john

I know RTFM but I can't find in the help files how to add comments to
SQL.
I've tried everything I can think off but nothing works.
Also, I format my queries nicely, save them, and Access removes all the
formating.
How do I prevent this from happening?
 
J

John Spencer

The answer is that Access does not support comments in queries and it does
not retain any formatting you have set. Both are shortcomings that I would
like to see changed.

You can use the description field to store some notes, but nothing directly
in the query itself.

Stephen Lebans has a way to "kind of" put comments in. Check out

http://www.lebans.com/addsqlcomments.htm

Perhaps, I should not have used the word "Kind of", since I've never
examined this fully.
 
J

John Vinson

I know RTFM but I can't find in the help files how to add comments to
SQL.

That's because you can't.
I've tried everything I can think off but nothing works.
Also, I format my queries nicely, save them, and Access removes all the
formating.

That's just what the query optimizer does.
How do I prevent this from happening?

Never open the query in the Query Design window, for one thing... and
just put up with the annoyance, for the other.

John W. Vinson[MVP]
 
D

Duane Hookom

You can add pseudo comments to your queries like:

SELECT Customers.*, IIf(-1,Null,"These are your comments. Take them or leave
them") as IgnoreMe
FROM Customers;
 

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