Field names

RickDB

Registered User.
Local time
Today, 12:32
Joined
Jun 29, 2006
Messages
101
If 2 tables have a field named 'EmployeeID' (for example), are you screwed when it comes to queries and vba, as far as selecting fields / specifying data goes?

Thank you!
 
No. Not screwed.

If the tables have a relationship through EmployeeID, you actually prefer the names to be the same. If two tables holding EmployeeID have a common relationship with a third table also holding EmployeeID, this also is acceptable.

If the tables aren't related, there is no TECHNICAL reason you couldn't do this, though I would worry about the confusion potential. Nonetheless, all you have to do in this case is to qualify the field name with the table name.

Like, [Employees].[EmployeeID] = [AssignedProjects].[EmployeeID]

See, no sweat! Just a little extra typing, that's all.
 
Thanks Doc, I just ran into that problem and had a "oh no" moment.

I did find the answer before your reply (thank you though!!!), but the syntax used an exclamation instead of period
![field] instead of
.[field] is there a difference? And if they are the same thing, are there circumstances you would use one over the other, or is it simply a matter of preference?

Thanks Doc!
 
Bang vs. Dot depends on whose DB you are using. In SQL, DOT syntax works and is what I use more often than not. There was a thread in this forum about the difference between BANG and DOT some time ago. Guess I'll have to look it up. My memory ain't what it used to be.
 

Users who are viewing this thread

Back
Top Bottom