Share via

comments inside query

Anonymous
2016-01-12T10:46:28+00:00

Hi

im quite new to access and i cant find how to write comments inside a query so id remember what each part of the SQL code is doing, googling is not very helpful, from what i see its not possible, only via some complex workaround

please advise

Yossi

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Anonymous
    2016-01-12T12:45:47+00:00

    Unfortunately, unlike more advanced SQL products, JET/ACE SQL as used in Access does not support comments within SQL statements.  Because Access is oriented towards the point-and-click design interface for creating queries it has other undesirable side-effects.  Throwing in unnecessary column names, brackets and parentheses if a query is saved in design view is the most noticeable, but other effects can be even more annoying, and potentially harmful in some cases.  Even if a query is saved in SQL view the carriage returns and indenting can be disrupted. As an example of more disruptive behaviour, if nullable parameters are used in Boolean OR operations and the query is saved in design view Access will move things around, resulting in an SQL statement of such complexity that the simple nature of the logic is at best obscured, or at worst the query will be too complex to open.

    For these reasons, I would suggest that you do as I do and, as part of the application's documentation, copy the SQL statements to a text file.  You can then insert comments and, in the event of a complex query going AOT, easily revert to the original by pasting the SQL statement from the text file back into the query designer in SQL view, editing out the comment lines.

    10+ people found this answer helpful.
    0 comments No comments
  2. Anonymous
    2016-01-12T11:57:56+00:00

    Hi,

    No, it is not possible. You can use the query Description property just for a comment.

    Ciao Mimmo

    2 people found this answer helpful.
    0 comments No comments