Full Version: User Name
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
tonde
I have a table with employees names and numbers. The same table was used to create our system UserNames for all employees with the user name having a prefix "kgn" followed by the staff number. Now I want a database I have created to display the name of the staff member logged in to the system. I am able to extract the UserName from the system but how now do I tell my database to ignore the prefix "kgn"

LoggedStaff.Value = "CURRENT USER: " & DLookup("[StaffName]", "tblStafflist", "[Staff_No] = fOSUserName()") - This does not work because Staff No=12345 and fOSUserName = kgn12345.
fkegley
Change this part:

fOSUserName()"

to this: (I had it wrong the first time so here is corrected version:)

Mid$(fOSUserName(),4)"

Edited by: fkegley on Wed Aug 9 9:52:10 EDT 2006.
kuifjexx
Welcome to UA

mid("kgn12345",4) returns 12345
so mid(fOSUserName(),4) should help you

Greetz from Belgium compute.gif

Luc aka Kuifjexx
tonde
Did, and got 'Data type mismatch.'
tonde
It worked. You guys are great. This was my first post and my problem was solved pronto. God bless you. Greetings from Kenya.
kuifjexx
Glad we could help you

Greetz from Belgium compute.gif

Luc aka Kuifjexx
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.