Where to add the character - How to understand?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Dear all,
I am still learning - please can some one tell me
how can I understand that where to put the open brackets and closed
brackets and also the following
{ } [ ] ( )
- how to understand the importance of the above characters - please I am
just learning

Rgds
Anver
 
Just about anytime that you are using the name of one of your fields,
tables, queries, forms, reports, text boxes, etc, you will want to put
the name in brackets [ ].

Example:
TotalPrice:
[ProductTable].[UnitPrice]*[OrdersDetailTable].[QuantityOrdered]

If you are using functions for calculations, the function name is
usually follwed by parentheses ( ), with the arguments for the function
inside.

Example:
Days: DateDiff("d", [OrderTable].[OrderDate], [OrderTable].[ShipDate])

I can't think of anything that uses the braces { }.

Keven
 
Dear all,
I am still learning - please can some one tell me
how can I understand that where to put the open brackets and closed
brackets and also the following
{ } [ ] ( )

Ummm... put them where they belong.

Curly brackets are not used in VBA or Access SQL.
Square brackets are used around the names of tables, fields, control
names, etc.
Parentheses are used for nesting logic.

For instance, a valid SQL query might be

SELECT [TableA].[ThisField], [TableB].[ThatField],
TableC.SomeOtherField
FROM ([TableA] INNER JOIN [TableB] ON [TableA].[Badly Named Field] =
[TableB].BetterName) INNER JOIN [TableC] ON [TableC].[Fieldname] =
[TableA].[Badly Named Field]
WHERE TableA.ThisField = [Forms]![MyFormName]![txtSomeTextbox]

Note that a fieldname (or control name, or form name) containing any
special characters - blanks in particular - must be enclosed in square
brackets, as must parameters in the query. If the name is "clean" -
BetterName or ThisField in my example - then the brackets are
optional; but they never hurt.

Perhaps you could explain what you're trying to accomplish with a
specific example; the subject of "where do I put parentheses" is just
much too broad.

John W. Vinson[MVP]
 
Back
Top