I am not new but I still don't understand some things. When I write commands
my biggest problem is the format. Could someone explain where the () go and
where the [] go and where the "" go, and where commas go. I think I'm
cruising right along and I get syntax errors. Thanks so much!!
"Where they belong" is about all I can say generally.
[ ] is used to delimit the names of Tables, Fields, Controls, Forms and other
objects. The brackets aren't always required, but if your object name
(unwisely) contains blanks or special characters, you must use the brackets.
It never hurts to include them.
" is a string delimiter. You can define a string constant in an expression by
surrounding it with quotemarks. If you're creating a Query criterion for a
Text field the criterion must be delimited either by " or by '.
Parentheses are used to delimit the arguments to a function or to control the
order of operations in a query.
For instance, DateDiff("yyyy", [Datefield], Date()) uses all three kinds of
delimiter:
Datediff(... arguments ...)
uses parentheses to enclose the three required arguments.
The first argument is a literal text string yyyy; to tell Access that it's a
literal, you enclose it in " marks.
The second argument is a fieldname (or it might be a control name on a form);
to tell Access that's what it is, you enclose it in brackets.
The Date() function doesn't take any arguments, but the parentheses tell
Access that you're talking about the builtin Date() function, rather than some
variable named Date or a control or fieldname Date.
If you are having syntax errors with some particular type of expression, post
and example and we'll try to describe the correct syntax - and more
importantly the logic behind the correct syntax.
John W. Vinson [MVP]