This is a reference guide for the SQL engine that is inside of
Microsoft Access. These SQL statements can be used inside of Access;
inside the SQL View of the of the Query Design menu or in the
VBA editor, where the SQL statments can be used inside the SQL string
portions of DAO or ADO objects or any other VBA objects that use
SQL statments.
Instead of typing straing in the SQL view; if you don't already have it installed,
Notepad++ is a great tool to write code in, then you can copy and paste it
into the SQL view.
Notepad++ Link
In an attempt to make it easy to understand the syntax
at a glance, I have color coded it.
Blue - Is used to identify reserved keywords/characters that are used
by the SQL engine, i.e. SELECT, FROM, or WHERE.
Purple - Is used to identify portions of the SQL statement
that are defined by the user, i.e. Column Names, Table Names, Inputed Values.
Other notes:
Strings - If you are constraining rows with a string, it must be enclosed in ""
double quotation or '' single quotation.
Number Values - If you are constraining rows with a number value it does not need to be
enclosed in "" double quotation or '' single quotation.
Dates - If you are constraining rows with a date, it must be enclosed in ##.
"" Double Quotation marks vs '' Single Quotation marks - In most cases
when you can enclose strings withing either of these and it will work just the same.
However, when you are entering a SQL statement into VBA the '' single
quotation marks are far better to use due to the fact that the the SQL string will
be bookended by "" double quotation marks. Personally I just always use '' marks for consistency.