Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Database Design / June 2005

Tip: Looking for answers? Try searching our database.

The use of underscore characters in field naming conventions

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
CAD Fiend - 28 Jun 2005 23:12 GMT
Hello,

What is the proper naming convention for naming fields?  Some people
will use underscores between the key words, some just use caps.  I
believe that you also should not us spaces. Is that correct?  What about
for table names and such?  Does the same practice apply?

TIA.

Phil.
Douglas J. Steele - 28 Jun 2005 23:35 GMT
There's really no right answer: naming conventions are just that,
conventions. (other than no spaces: few, if any, argue that spaces are
okay!)

I personally prefer "camel case": using CapitalLetterToSeparateWords.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> Hello,
>
[quoted text clipped - 6 lines]
>
> Phil.
CAD Fiend - 29 Jun 2005 00:07 GMT
Gotcha.  But one thing about camel case is that you can't use the CTRL Left
Arrow or Right Arrow on the keyboard when all of the text is together like
that.

> There's really no right answer: naming conventions are just that,
> conventions. (other than no spaces: few, if any, argue that spaces are
[quoted text clipped - 17 lines]
> >
> > Phil.
Douglas J. Steele - 29 Jun 2005 02:06 GMT
Can't use Ctrl-Left Arrow or Ctrl-Right Arrow to do what?

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> Gotcha.  But one thing about camel case is that you can't use the CTRL
> Left
[quoted text clipped - 23 lines]
>> >
>> > Phil.
RuralGuy - 29 Jun 2005 02:49 GMT
> Can't use Ctrl-Left Arrow or Ctrl-Right Arrow to do what?

Word Left and Word Right!  Old WordStar commands are hard to kill!

Signature

RuralGuy

Please reply to the newsgroup so all may benefit.

CAD Fiend - 29 Jun 2005 16:55 GMT
That's right!  But actually that's been a thing with me since WP I
think!  But it works with any MS app as well.

> > Can't use Ctrl-Left Arrow or Ctrl-Right Arrow to do what?
>
[quoted text clipped - 4 lines]
>
> Please reply to the newsgroup so all may benefit.
CAD Fiend - 29 Jun 2005 16:54 GMT
Sorry, Doug.  I meant "can't use CRTL-Left Arrow to navigate over whole words
instead of one character at a time".

> Can't use Ctrl-Left Arrow or Ctrl-Right Arrow to do what?
>
[quoted text clipped - 30 lines]
> >> >
> >> > Phil.
Brendan Reynolds - 29 Jun 2005 09:46 GMT
Ctrl+Left and Ctrl+Right don't work with underscores in the VBA editor
either (though they do in SQL view). And for most people, the underscore is
a seldom-used (or at least 'less frequently used') character, and will slow
down typing. So there are pros and cons, for and against. As others have
said, there's really no clear-cut right or wrong here.

I'm currently reading a book on coding guidelines for .NET, and one of the
recommendations the authors make is that you shouldn't use underscores in
names of public properties or methods, but it's OK to use them in private
properties or methods. In other words, if you're the only person who will
ever have to type those names, it's just  a matter of personal preference.
But if you're exposing those names to others it is better to avoid
underscores. I'm inclined to agree with that.

Signature

Brendan Reynolds (MVP)

> Gotcha.  But one thing about camel case is that you can't use the CTRL
> Left
[quoted text clipped - 23 lines]
>> >
>> > Phil.
CAD Fiend - 29 Jun 2005 17:02 GMT
> Ctrl+Left and Ctrl+Right don't work with underscores in the VBA editor

Really?  I just went and opened my VBA editor (v6.3 ) in Access, and it worked
fine for me.  Are we talking about the same editor?

> either (though they do in SQL view). And for most people, the underscore is
> a seldom-used (or at least 'less frequently used') character, and will slow
> down typing.

Yeah, it DOES slow you down a little. But I think it's worth it, when it comes
to easier navigation over words, and being easier to read.

> So there are pros and cons, for and against. As others have
> said, there's really no clear-cut right or wrong here.
[quoted text clipped - 6 lines]
> But if you're exposing those names to others it is better to avoid
> underscores. I'm inclined to agree with that.

Hmm. Interesting point.

> --
> Brendan Reynolds (MVP)
[quoted text clipped - 26 lines]
> >> >
> >> > Phil.
Brendan Reynolds - 29 Jun 2005 19:56 GMT
I enter the following into the VBA editor (Access 2003, VBA 6.3) ...

Dim using_underscore As String

I place the insertion point in front of the first 'u'. I hold down the
Control key and press the right arrow key. The insertion point jumps to just
in front of the 'A' in 'As', treating 'using_underscore' as one word.

I enter the following in SQL view ...

SELECT using_underscore
FROM tblTest;

I place the insertion point in front of the first 'u'. I hold down the
Control key and press the right arrow key. The insertion point jumps to a
position between the underscore character and the first 'u' in the word
'underscore', treating 'using' and 'underscore' as separate words, the same
behaviour that you would get if the underscore was a space.

Do you see different behaviour?

Signature

Brendan Reynolds (MVP)

>> Ctrl+Left and Ctrl+Right don't work with underscores in the VBA editor
>
[quoted text clipped - 58 lines]
>> >> >
>> >> > Phil.
John Vinson - 29 Jun 2005 01:31 GMT
>Hello,
>
[quoted text clipped - 6 lines]
>
>Phil.

Underscores are pretty much acceptable: Access, SQL/Server, Oracle,
MySQL all accept them in field_names. Blanks are *allowed* in Access
but cause real headaches in these other dbms's (they are allowed, by
quoting the names, but they're still a hassle). CamelCaseCapitals (or
Camel_Case_Capitals if you prefer) make for easier reading, but
remember that table and fieldnames are not case sensitive so there is
no distinction between names which differ OnLy iN CapiTalIZation.

                 John W. Vinson[MVP]    
CAD Fiend - 29 Jun 2005 16:58 GMT
> >Hello,
> >
[quoted text clipped - 12 lines]
> quoting the names, but they're still a hassle). CamelCaseCapitals (or
> Camel_Case_Capitals if you prefer) make for easier reading

I happen to only disagree with this one point, John.  I find the underscores
make it easier to read the field names, but that's just me.

> , but
> remember that table and fieldnames are not case sensitive so there is
> no distinction between names which differ OnLy iN CapiTalIZation.
>
>                   John W. Vinson[MVP]
John Vinson - 29 Jun 2005 21:18 GMT
>I happen to only disagree with this one point, John.  I find the underscores
>make it easier to read the field names, but that's just me.

De gustibus non disputandum est!

                 John W. Vinson[MVP]    
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.