Results 1 to 4 of 4
  1. #1
    4 Star Lounger
    Join Date
    Jan 2003
    Location
    Central Florida, USA
    Posts
    505
    Thanks
    5
    Thanked 0 Times in 0 Posts

    .Name vs .name (2003)

    I have a strange anomaly and don't know where to start to find the solution.

    In VBA in Access when I am formatting a font using
    With xlApp.Cells.Font
    .name = "Arial"

    In Excel it looks like
    With Selection.Font
    .Name = "Arial"

    When typing in VBA in Access the "Name" pops up in the window, but it still switches it to a lowercase "n". I am concerned that this may create a problem later on. FWIW, the code still performs as it should, i.e. it puts the correct font into the spreadsheet. But isn't this indicative of an underlying problem in my Access VBA?

    Thanks in advance for your ideas.

    Ken

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: .Name vs .name (2003)

    As far as I know, those property names are not case sensitive. But why does it do that? I have no idea...

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: .Name vs .name (2003)

    This is not a problem, at most a small, insignificant bug in the way Access VBA treats names.

    When you define a field or variable in this database, Access stores its name in the cache of user-defined names exactly as you spell it, even if it coinicides with a built-in name.

    When Access autoformats code, it first looks at the cache of user-defined names, and if it finds a match, it uses the spelling from the cache. If there is no match, it looks at the list of built-in names, and if it finds a match, it uses the spelling from this list. If there is no match there either, it uses the spelling exactly as you entered it.

    So if you ever created a field or variable named name with a lower-case n, name will be in the cache of user-defined names, and it will override Name.

    When you remove or rename the item named name, Access should remove name from the cache, but that doesn't always happen. And so it may occur that Access stubbornly uses name even if there is no item explicitly named that way.

  4. #4
    4 Star Lounger
    Join Date
    Jan 2003
    Location
    Central Florida, USA
    Posts
    505
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Re: .Name vs .name (2003)

    Thanks to both of you. I have always been careful not to use "control" or "reserved" words in my naming conventions. But I have opened up other's databases in the past that may have had "name" as a field name or table name of something.

    At any rate, if you guys tell me I am ok, I can take that to bank and sleep well at night.

    Thanks,
    Ken

Posting Permissions

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