By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,963 Members | 2,016 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,963 IT Pros & Developers. It's quick & easy.

Create lower case login from 2 Upper Case Fields

P: 5

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

Jun 28 '10 #1

✓ answered by Delerna

Expand|Select|Wrap|Line Numbers
  1. SELECT lcase(left(FirstNameField,1)) & lcase(LastNameField)
  2. FROM TheTable

Share this Question
Share on Google+
6 Replies

Expert 100+
P: 1,134
Expand|Select|Wrap|Line Numbers
  1. SELECT lcase(left(FirstNameField,1)) & lcase(LastNameField)
  2. FROM TheTable
Jun 28 '10 #2

P: 5
Thank You
For my query I typed:
Login: lcase(left(Preferred 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.
Jun 28 '10 #3

P: 5
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.
Jun 28 '10 #4

P: 5
Thanks again - i have now been able to do this login at another work place....

John Smith = johnsm

Jun 30 '10 #5

Expert 100+
P: 1,134
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.
Jun 30 '10 #6

P: 5
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!!)

Jul 1 '10 #7

Post your reply

Sign in to post your reply or Sign up for a free account.