SQL Code Formatting in MS Access

I am relatively new to SQL coding, so pardon my ignorance.

When I write an SQL query in MS Access, I format it a certian way to make it easier to read. When I run the query and go back to my SQL code, often times Access has changed the format. Here is a simple example below.

I write:

SELECT
Table1.Field1
, Table1.Field2
FROM
Table1

WHERE
Table1.Field2 = “Yes”

I run the query and view the results. When I go back to my SQL code, it looks like this:

SELECT Table1.Field1, Table1.Field2
FROM Table1
WHERE (((Table1.Field2)=“Yes”));

Not a huge deal in this example, but as I write more complex queries the Access version of the code I wirte becomes a hot mess. Very difficult to read when editing. Is there some sort of setting I can change to force Access to retain the code format that I use when writing the SQL query?

as far as i know, no

annoying, isn’t it…

i keep my queries in a folder on my file system, where i can edit them easily with my text editor of choice (the access sql view window is worse than notepad), and then copy/paste into access, i never save the queries in access

well, except if i need to save one for a view query, but that’s okay, because i believe if you save it without running it, it keeps the original punctuation

i think

:slight_smile:

There’s a trick:

SELECT * FROM (SELECT
Table1.Field1
, Table1.Field2
FROM
Table1

WHERE
Table1.Field2 = “Yes”) AS query1

You’ll only loose the linebreaks…