MS Access Table Query showing Customer Name as a code.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ms2BSwagg
    New Member
    • Jun 2015
    • 4

    MS Access Table Query showing Customer Name as a code.

    HI,
    I would like to show the 1st 5 characters of Customers First and Last Name combined into one field.
    Eg John Snow = SnowJ
    Thanks in advance.
  • Seth Schrock
    Recognized Expert Specialist
    • Dec 2010
    • 2965

    #2
    You would use the Left() function on the combined texts.
    Code:
    Left(LastName & FirstName, 5) As CustomerCode

    Comment

    • Ms2BSwagg
      New Member
      • Jun 2015
      • 4

      #3
      Hey Seth,
      Thank you for the response.
      Something so simple hahhaha.
      Regards

      Comment

      • zmbd
        Recognized Expert Moderator Expert
        • Mar 2012
        • 5501

        #4
        Something to consider...
        My last name has more than five characters....
        So if you take my first name (Zmbd) and then my last name (Babcdefgh) use the above left function you get Babcd not a BabcdZ or BabcZ etc...

        Is this truly what you want?

        Code:
        Left([Lastname],4) & Left([FirstName,1) As CustomerCode
        Would return the BabcZ

        Have you considered how to handle the case of the shorter last/sur-names as one might find for someone born in Korea, Japan, China, etc?

        Comment

        Working...