Hlp with code for String

  • Thread starter Thread starter Junior
  • Start date Start date
J

Junior

I am attempting to use user login name to set determine permissions to
various parts of a DB.
The log in name may be either 11 or 12 characters formated XXXYYYusername
I want to strip off the first 6 characters XXXYYY
and set strUserID as the last 5 or 6 characters.
How can i change the following code to accomplish this?
strUser = GetLoginName()
strUserID = Right(strUser, 5)
 
If you want to strip off the first 6 characters and return the remainder,
I'd suggest you use the Mid() function:

strUserID = Mid(strUser, 7)

Since you indicate that the value you want could be either 5 or 6
characters, the above will return everything after the first 6 characters.


hth,
 
Great, thanks
Cheryl Fischer said:
If you want to strip off the first 6 characters and return the remainder,
I'd suggest you use the Mid() function:

strUserID = Mid(strUser, 7)

Since you indicate that the value you want could be either 5 or 6
characters, the above will return everything after the first 6 characters.


hth,
 
Back
Top