Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    St. Marys, Ontario, Canada
    Posts
    270
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Labels and a field named "Name"

    I have found in Access 2000 (only) that if I name a field in a table "name" that when I create Avery labels (5163) using the label wizard, the name field doesn't work.

    Has anybody else had this problem? If so, how do I fix it without renaming my field?

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Labels and a field named "Name"

    That isn't the only place where you'll have problems with fields named things like "name" and "date". In any programming language, certain words are used for internal methods and properties and built in functions. You tripped over the "name" issue, but you'll probably find others if you don't start giving your fields more descriptive labels, like ContactName, for instance.
    Charlotte

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    The Netherlands
    Posts
    216
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Labels and a field named "Name"

    Like Charlotte says, name is a preserved word in VBA.
    You will net get problems like this if you apply a naming convention like LNC. Check Woody's Access Watch #3.02 (yes the latest one). Here you will find a description of naming conventions.

    Bart

  4. #4
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    St. Marys, Ontario, Canada
    Posts
    270
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Labels and a field named "Name"

    If you name the field something like ContactName, but use the caption "Name" it should work ok, right?

  5. #5
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    The Netherlands
    Posts
    216
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Labels and a field named "Name"

    Yes, that should work.
    Although, if you apply a naming convention, you would call it txtContactName (that is the name of the control on your form or report) and put in the caption of the label (with the name lblContactName) &Name, ensuring the hotkey for the field is ALT+N.

  6. #6
    4 Star Lounger
    Join Date
    Dec 2000
    Location
    London, Ontario, Canada
    Posts
    437
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Labels and a field named

    Hard to believe that anyone here would not be subscribed to Woody's Access Watch but just in case, the Leszynski Naming Convention (LNC) can be found here: http://www.kwery.com and the Reddick VBA Naming Convention here:http://www.xoc.net. I wish I had constructed my first databases using conventions. Life would be a lot easier now. In addition to avoiding pitfalls mentioned in this thread. it promotes legibility of code both for the developer and anyone who may come along later.

  7. #7
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Labels and a field named

    Wait, guys. Neither of the naming conventions really suggest applying naming convention tags to field names, only to things like tables, queries, forms, controls, variables, etc. Naming fields that way would mean having to change names throughout the code everytime you decided a field should be a long rather than an integer.

    Most of you probably don't remember when it was the Leszynski-Reddick naming convention, but that's when I started using it. Over the years, I've found that it works quite well for everything but fields but code routines.
    Charlotte

  8. #8
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Cornwall, England
    Posts
    393
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Labels and a field named

    I am gradually learning the LNC format as i go through a VB course. I have been looking for a list of all the various possibilities as i am currently programming at work at a higher level than the course has reached. i went to http://www.kwery.com and was amazed to see that this site is charging for the listing. surely if developers want a standard by which we all abide this sort of info should be free?

  9. #9
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    St. Marys, Ontario, Canada
    Posts
    270
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Labels and a field named

    Wow! All of you truly amaze me and show me how much more I need to learn in Access. For the ordinary user like me, is it sufficient to say then that for a field that contains names, I name it FirstName (or something like this), but can use the caption property to have it appear as Name in tables and forms and reports?[img]/w3timages/icons/clever.gif[/img]

  10. #10
    4 Star Lounger
    Join Date
    Dec 2000
    Location
    London, Ontario, Canada
    Posts
    437
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Labels and a field named

    You're right. I just copied the link from WAW without checking it first [img]/w3timages/icons/spook.gif[/img] try here No Charge. [img]/w3timages/icons/wink.gif[/img]

  11. #11
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Cornwall, England
    Posts
    393
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Labels and a field named

    In short yes.
    It can get a little more complicated when you have more than one table containing fields that contain data of a similar sort. EG you may have a table for Customers and another for Suppliers, each table may contain details about the individual at the company so you would have firstname x2 and lastname x2 (1 each in each table). To avoid confusion it is usual to name fields within a table with a prefix that will make it unique. This would result in:
    cusFirstName;cusLastName and supFirstName;supLastName. This will then make more sense when you come to create Queries,Reports,Forms as the field names will explain content and location.

  12. #12
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Cornwall, England
    Posts
    393
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Labels and a field named

    Cheers Brian, I guessed there would be a free copy somewhere, i've just never bothered to go looking.
    I'll get a copy now.[img]/w3timages/icons/laugh.gif[/img]

  13. #13
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Labels and a field named

    Last time I looked Helen Feddema had an add-in on her site that would apply the LNC to database objects, but I think it was an Access 97 add-in. Don't know if she ever came up with a 2000 add-in, and 97 add-ins don't work in 2000 without modification.
    Charlotte

  14. #14
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Pennsylvania, USA
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Labels and a field named

    When you add nameing conventions to your field names, you useing level three of LNC

    John
    threecrow

    Don't make excuses. It's what you do, not why you didn't.

  15. #15
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Labels and a field named

    Has he actually started recommending that? He used to include it for anal retentive types but not recommend it. I personally think it's overkill and distracting to use field-level tags.
    Charlotte

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •