Create lower case login from 2 Upper Case Fields

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dezzmo
    New Member
    • Jun 2010
    • 5

    Create lower case login from 2 Upper Case Fields

    Hello

    I am using Access97 - workplace requirement.

    I want to create a query where I can generate a login field that takes the 1st letter of the 1st field (PREFERRED NAME) and combine it with the entire 2nd field (FAMILY NAME)

    eg - JOHN SMITH = jsmith

    Thanks
    :-Dz
  • Delerna
    Recognized Expert Top Contributor
    • Jan 2008
    • 1134

    #2
    Code:
    SELECT lcase(left(FirstNameField,1)) & lcase(LastNameField)
    FROM TheTable
    Last edited by NeoPa; Jun 28 '10, 03:23 PM. Reason: Please use the [CODE] tags provided.

    Comment

    • dezzmo
      New Member
      • Jun 2010
      • 5

      #3
      Thank You
      For my query I typed:
      Login: lcase(left(Pref erred Name,1)) & lcase(Family Name)

      However, I get an error message - "The expression you entered contains an invalid syntax. You may entered an operand without an operator"

      And after that, "NAME" in the 'Preferred Name' field is highlighted.

      Comment

      • dezzmo
        New Member
        • Jun 2010
        • 5

        #4
        I have corrected it - i needed to do....

        Login: LCase(left([Preferred Name],1)) & LCase([Family Name])

        The extra bracket is needed around the fields due to them having two words.

        Thanks for the tip.
        :-Dz

        Comment

        • dezzmo
          New Member
          • Jun 2010
          • 5

          #5
          Originally posted by dezzmo
          I have corrected it - i needed to do....

          Login: LCase(left([Preferred Name],1)) & LCase([Family Name])

          The extra bracket is needed around the fields due to them having two words.

          Thanks for the tip.
          :-Dz
          Thanks again - i have now been able to do this login at another work place....

          John Smith = johnsm

          :-D

          Comment

          • Delerna
            Recognized Expert Top Contributor
            • Jan 2008
            • 1134

            #6
            you are welcome

            The reason for the error being "due to having 2 words in the field name" is correct but the reason is more ... because there are spaces in the field Name.
            The two statements mean the same thing though so it's a bit pedantic

            It's one reason I name fields like FirstName rather than First Name.
            Other people like First_Name.

            Another time you would need the square braces is if the field name was a number or started with a number.

            Comment

            • dezzmo
              New Member
              • Jun 2010
              • 5

              #7
              That's handy to know. Those 2 word fields with spaces were preset by the organsation in their administration software package - which I am able to tap into to extract data (legitimately!! )

              ;-Dz

              Comment

              Working...