Naming fields & tables, spaces between text

  • Thread starter Thread starter CAD Fiend
  • Start date Start date
C

CAD Fiend

Since I am VERY new to Access, I will start here in this NG.

In my textbook, they are using no spaces when creating field names, such
as CustomerName. However, I've heard that it's good practice to use an
underscore character between the names, such as Customer_Name. Is this
true? What is good convention?

Does this also apply to tables, such as tbl_Customer_List, instead of
Customer List or CustomerList?

Lastly, when (if ever) is it OK to put spaces in between text in your
database? Like, if I had an entry in a Field called Address, it would
normally read; 1250 Main Street, but are you supposed to make it without
spaces, like 1250MainStreet, or 1250_Main_Street? Or if I had a Field
called City, how should I put something like New Orleans? Would it be
NewOrleans, or New_Orleans?

IMO, it seems like it's easier to read when there's an underscore
between the words.

TIA.
 
Hi

welcome, this is a good place to start :)

here's my understanding on how it all works .. others will probably pop in
with their ideas ...

basic database design convention says that object names (tables, fields,
controls, forms, report, macro etc) names should not have spaces in them
(and it does save typing time if you don't use spaces). DATA however, can,
and should contain spaces.

So the table CustomerDetails should have no spaces, nor should the field
CustomerAddress however the actual address itself (the data) should be
entered exactly the way you want to get it out (i.e. with spaces & commas &
capitalisation etc).

Now whether you prefer Customer_Details or CustomerDetails or
Customerdetails (IMHO) is purely a matter of preference, personally i like
the second option as it means i don't have to type a "_" :)

The next convention you mention is that of the use of TBL in the table name
.... it is recommended that when it comes to object types (tables, forms,
reports, queries, macros etc) you use a prefix to indicate what type of
object it is that you're working with. This does make it a bit easier if
you have a table called CustomerDetails and a form also called
CustomerDetails - TBL_CustomerDetails and FRM_CustomerDetails leave no room
for confusion. Some people also affix the datatype to their field names
(str_CustomerFirstName, dte_CustomerDateofBirth) but i don't go that far.

However, i guess the bottom line is that you need to choose an approach that
works for you and be consistent in that approach.

You might like to check out
http://www.mvps.org/access/tencommandments.htm

(and some of the other things on that web site).

Cheers
JulieD
 
Back
Top