Need help to figure this out

  • Thread starter Thread starter Jack
  • Start date Start date
J

Jack

Hi,
I have user login form wherre I am captuing the userid in the following:

Me.txtDataInputEmployee = Forms!LoginForm!UserName

Now the above yields john doe (say)

I need to have only the first name.
How do I change the code to get only John. Thanks.
 
Thanks for the big help TOny
and Jeff. I appreciate it. Jeff
you made a very good point.
There may be more than one
John. Hence how will the code
change if I try to get something
say for example john_doe.
Thanks.
 
That's how I read it too, must spend too much time doing websites!!

Jack, what do you mean how will it change for john_doe?

There are no spaces (chr(13)'s) to find, so my code will return 0 to denote
that there are no spaces, so it would return "" unless you check for 0 and /
or look for _'s or other such characters at the same time.

TonyT
 
Thanks for the big help TOny
and Jeff. I appreciate it. Jeff
you made a very good point.
There may be more than one
John. Hence how will the code
change if I try to get something
say for example john_doe.

You could use

Replace([namefield], " ", "_")

to replace all blanks with underscores. This won't help if you have two people
with the same first and last name (and I once was a postdoc at a university
where there was a Professor John W. Vinson... he got one of my paychecks, I
got two of his income tax bills... sigh...)
 
Back
Top