tonde
Aug 9 2006, 08:44 AM
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
Aug 9 2006, 08:45 AM
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
Aug 9 2006, 08:48 AM
Welcome to UA
mid("kgn12345",4) returns 12345
so mid(fOSUserName(),4) should help you
Greetz from Belgium
Luc aka Kuifjexx
tonde
Aug 9 2006, 09:01 AM
Did, and got 'Data type mismatch.'
tonde
Aug 9 2006, 09:18 AM
It worked. You guys are great. This was my first post and my problem was solved pronto. God bless you. Greetings from Kenya.
kuifjexx
Aug 9 2006, 09:27 AM
Glad we could help you
Greetz from Belgium

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.