Username

N

Naz

Hi

I'm trying to get the full name of the current user and reverse it from
surname firstname to firstname surname, using the following code, but it
doesn't work.
fgetfullname is a function that returns surname firstname
If i split it up i retrieves the surname and first name correctly but for
me.corname it just shows a bunch of question marks for the surname like this

me.corname = "john ?????"


Splitting it into firstname and surname give the correct answer for each but
again concatenating it and these question marks appear.

This is the code

userfirstname = Mid(fGetFullNameOfLoggedUser(),
InStr(fGetFullNameOfLoggedUser(), " ") + 1, 20) &
Left(fGetFullNameOfLoggedUser(), InStr(fGetFullNameOfLoggedUser(), " "))

me.corname = userfirstname


Can anyone help please?
 
T

Tom van Stiphout

On Mon, 12 Jan 2009 20:02:04 -0800, Naz

Your code may be inelegant, inefficient, and unable to handle all
names, but for simple "Naz John" kind of names it does kinda work.

Set a breakpoint on the last line. What is the value of UserFirstName?

-Tom.
Microsoft Access MVP
 
N

Naz

Hi Tom

I've tried setting a break point and if my name was say Smith John, the
value of UserFirstname shows correctly as when i hoover over it.

userfirstname = John Smith


If i split the code into first name and surname i get

firstname = John
Surname = smith

userfirstname = firstname &" "& surname

hoovering over firstname shows it correctly as does surname but over
userfirstname it still shows John ?????.

Don't understand why it won't work, should be just simple concatenation.
 
T

Tom van Stiphout

On Tue, 13 Jan 2009 01:04:01 -0800, Naz

If I understand you correctly you have determined that the immediate
problem is not with the algorithm, but with the control where you are
displaying it.
So tell us more about that control. If I create a new form with a
single textbox on it, and in the Form_Load event write:
Me.Text1.Value = "John"
it will work every time. How are your code and/or form properties
and/or control properties different?

-Tom.
Microsoft Access MVP
 
N

Naz

Hi Tom

I couldn't figure it out in the end, it just seemed like a weird thing. If i
took a fullname split it into firstname and surname, i could reconsititute it
surname & firstname, just not the other way.

In the end i found a different solution, probably for the best.

However, thank you for taking the time to look at the problem i really
appreciate it.
 

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