Results 1 to 9 of 9
  1. #1
    gsrajan is offline Novice
    Windows XP Access 2013
    Join Date
    Dec 2013
    Posts
    5

    Last Name in capital

    I have a text field which has last name and the first name of the customer. I wish to change the last name in capital and the firist name with the first letter in capital ( Example: JOHN, Doe ) with a comma. Please let me know the sql for this.



    Thanks for your help.

    Rajan.

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Perhaps the StrConv() function with vbProperCase is what you are after.

  3. #3
    gsrajan is offline Novice
    Windows XP Access 2013
    Join Date
    Dec 2013
    Posts
    5
    Yes, since both are in the same text box, I do not know how to do.

    Thanks for your reply

  4. #4
    gsrajan is offline Novice
    Windows XP Access 2013
    Join Date
    Dec 2013
    Posts
    5
    In short, whatever is in the left side of the comma, in capital and right side in vbpropercase.

    thanks,

    Rajan,

  5. #5
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    It will probably be best handled using VBA behind a form. You will need to get familiar with other functions too. Mid(), Left(), and perhaps instrConv()

  6. #6
    lfpm062010 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Location
    US
    Posts
    415
    ItsMe is right.

    But you can use those functions in a query as well. It just make the query looks complicated.

    This should do the job.

    UCase(Mid([Table1].[FullName],1,InStr([Table1].[FullName],",")-1)) & ", " & StrConv(Trim(Mid([Table1].[FullName],InStr([Table1].[FullName],",")+1)),3)

  7. #7
    gsrajan is offline Novice
    Windows XP Access 2013
    Join Date
    Dec 2013
    Posts
    5
    Thank you very much. I will try this.

    Rajan.

  8. #8
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    For the record, one field for a name is a bad design.... breaks the rules of normalization.

    If you had a "FirstName" field and a "LastName" field, converting the last name to uppercase would be trivial.

  9. #9
    gsrajan is offline Novice
    Windows XP Access 2013
    Join Date
    Dec 2013
    Posts
    5
    Thank you. But the existing database was created like this since the data was imported from excel in that format. I need to go with this.

    Thanks again.

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

Similar Threads

  1. Find first Capital letter in string
    By Dutch1956 in forum Programming
    Replies: 5
    Last Post: 09-07-2011, 03:14 PM
  2. capital letters
    By accesshelp in forum Forms
    Replies: 1
    Last Post: 07-14-2010, 12:37 PM
  3. Month to return in Capital Letters
    By Alex Motilal in forum Queries
    Replies: 3
    Last Post: 01-09-2010, 05:19 AM

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