Results 1 to 9 of 9
  1. #1
    mike2246 is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2019
    Posts
    5

    Proper Case Update Query


    I have an older database that has been managed by several people now and most fields are all different, some upper/lower/proper.

    For example how/where would I make the update query to change everything to proper case
    Table - Customer
    Column - Customer Name

    Thanks

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,778
    Check out strConv function. It will convert every first letter to upper case, so words that might not ordinarily be capitalized will be.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    mike2246 is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2019
    Posts
    5
    Quote Originally Posted by Micron View Post
    Check out strConv function. It will convert every first letter to upper case, so words that might not ordinarily be capitalized will be.
    I know that is the command, but not sure where or how to finish the command after strConv

  4. #4
    accesstos's Avatar
    accesstos is offline Expert
    Windows XP Access 2007
    Join Date
    Dec 2018
    Location
    Greece
    Posts
    551
    Quote Originally Posted by mike2246 View Post
    I have an older database that has been managed by several people now and most fields are all different, some upper/lower/proper.

    For example how/where would I make the update query to change everything to proper case
    Table - Customer
    Column - Customer Name

    Thanks
    Hi Mike!

    In a copy of the table Customer (say CustomerCopy) , run this query:
    Code:
    UPDATE CustomerCopy SET [Customer Name]= StrConv([Customer Name],3);
    If has updated successfully, repeat it for the Customer table.

  5. #5
    mike2246 is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2019
    Posts
    5
    Quote Originally Posted by accesstos View Post
    Hi Mike!

    In a copy of the table Customer (say CustomerCopy) , run this query:
    Code:
    UPDATE CustomerCopy SET [Customer Name]= StrConv([Customer Name],3);
    If has updated successfully, repeat it for the Customer table.
    That worked, Thanks! Now what do I do to the query to make it update multiple fields at once?

    I tried the following but it didn't work (UPDATE CustomerCopy SET CustomerCopy.Customer_Name = StrConv([Customer_Name],3), CustomerCopy.City = [UPDATE CustomerCopy SET CustomerCopy].[City]=StrConv([City],3);

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,895
    UPDATE CustomerCopy SET CustomerCopy.Customer_Name = StrConv([Customer_Name],3), CustomerCopy.City = StrConv([City],3);

    Just separate each update pair with comma.

    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    mike2246 is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2019
    Posts
    5
    Thanks, got it working with multiple fields and tables. Can I run a separate query or add to this one that will do a find/replace? for example there's about 10 names the don't need to be proper case (Mmg should be MMG, Miu should be MIU, etc.)

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,895
    Might have to do a separate update action for each replace. If this is a one time process, just use Find/Replace tool from the ribbon.

    Are those 3 letters the entire name?
    Last edited by June7; 10-28-2019 at 01:55 PM.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    accesstos's Avatar
    accesstos is offline Expert
    Windows XP Access 2007
    Join Date
    Dec 2018
    Location
    Greece
    Posts
    551
    Quote Originally Posted by mike2246 View Post
    Thanks, got it working with multiple fields and tables. Can I run a separate query or add to this one that will do a find/replace? for example there's about 10 names the don't need to be proper case (Mmg should be MMG, Miu should be MIU, etc.)
    You can use the IN() operator to specify the words that you want to convert to uppercase as follows:
    Code:
    UPDATE CustomerCopy SET [Customer Name]= StrConv([Customer Name],1) WHERE [Customer Name] IN("mmg", "miu", "otherName");

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

Similar Threads

  1. Replies: 4
    Last Post: 04-28-2019, 07:19 PM
  2. Change text case from upper to proper case
    By s.nolan in forum Access
    Replies: 1
    Last Post: 12-02-2015, 10:56 AM
  3. Replies: 3
    Last Post: 04-28-2014, 03:17 PM
  4. Proper Case or Capitalization help
    By tshirttom in forum Programming
    Replies: 5
    Last Post: 03-23-2012, 10:37 AM
  5. Setting the Default Value and Proper Case Example
    By pkstormy in forum Code Repository
    Replies: 0
    Last Post: 08-27-2010, 07:43 PM

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