Need help to figure this out

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.
 
J

Jack

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.
 
T

TonyT

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
 
J

John W. Vinson

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...)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top