Results 1 to 6 of 6
  1. #1
    wes9659 is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    Apr 2014
    Location
    Dover, Ohio
    Posts
    88

    Using Proper case with exceptions such as "and" "the" "is"


    I have created field named Family. I would like it to be in proper case and be triggered as an after-update event.
    Me.Family = StrConv(Me.Family, vbProperCase)
    However, I would like the words “and” “the” “is” to remain in lower case. Does anyone know how I would achieve this? Thank You in advance for all your help.

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,791
    I might be too late in answering, but if those words are in the same field (which seems odd for family last name if that's what this is about) you will need a custom function that can refer to a list of words that you don't want included (or are those 3 the only ones?).
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by Micron View Post

    ...if those words are in the same field (which seems odd for family last name if that's what this is about)...
    I agree! It really sounds as if you're inappropriately storing multiple pieces of data in a single field.

    Could we have some examples of this data...or better yet, a copy of your file with the name of the form involved ?

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    proper case has its limitations - what about

    McDonald
    O'Leary
    Saint-Stephens

    etc

  5. #5
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    I agree with ajax. your better option would be to use UCASE to store it as all upper case. I'll go a step further than Ajax too

    MacDonald is valid
    Macinaw is valid

    How do you determine which one should be capitalized?

    Seems to me you would have to have a fairly sophisticated algorithm to figure it all out if your data entry folks didn't type it in correctly where an all caps would take all of that away.

    Finally, you do not have to STORE your data the way you're proposing. You can store the data how it was originally entered and convert it whenever you need to display it on reports etc. This way you can go back to see what was originally entered if you encounter a 'weird' one.

  6. #6
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    if you are going to continue with your propercase you could try

    Me.Family = replace(replace(replace(StrConv(Me.Family, vbProperCase)," and "," and ")," the ", " the ")," is "," is ")

    note the spaces to identify separate words and not to change first or last words

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 12
    Last Post: 10-01-2018, 02:40 PM
  2. Replies: 3
    Last Post: 06-06-2018, 08:26 PM
  3. Replies: 3
    Last Post: 07-28-2017, 12:12 PM
  4. Replies: 1
    Last Post: 09-07-2015, 08:00 AM
  5. Replies: 1
    Last Post: 09-03-2014, 03:27 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums