Brackets and Exclamation Points

bnw

Registered User.
Local time
Today, 14:40
Joined
Sep 19, 2006
Messages
26
I have a question about the below query. I never use brackets and exclamation point to distinguish my table name and field names. Why are the brackets and exclamation point used in this query? :(This query is from a sample Access Database. I look forward to hearing from you soon.




SELECT DISTINCTROW Registration.EventID, Registration.AttendeeID, [Attendees]![LastName]+", "+[Attendees]![FirstName] AS [Attendee Name], Attendees.Company, Registration.RegistrationFee, qrySumOfPayments.TotalPayments
FROM Attendees INNER JOIN (Registration LEFT JOIN qrySumOfPayments ON Registration.RegistrationID=qrySumOfPayments.RegistrationID) ON Attendees.AttendeeID=Registration.[AttendeeID]
ORDER BY [Attendees]![LastName]+","+[Attendees]![FirstName];
 
Square brackets are used around field names if there are spaces in the name of the field. also if you have field names in two or mare tables in the query that are the same then you need to distinguish which table the field is looking at thus the [Table One]![Field One] syntax applies. The ! is telling access to look at this field in this table.

Short and sweet answer. A more defnitive answer can be obtained via Access help.
 
Square brackets are used around field names if there are spaces in the name of the field. also if you have field names in two or mare tables in the query that are the same then you need to distinguish which table the field is looking at thus the [Table One]![Field One] syntax applies. The ! is telling access to look at this field in this table.

Short and sweet answer. A more defnitive answer can be obtained via Access help.

Thanks DCrake

I knew about using the bracket when a field name(s) have spaces and thanks for the clarification on using the ! point as well as the brackets that distinguish a field name and table.
 

Users who are viewing this thread

Back
Top Bottom