Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replace, Left, and Right Functions

Status
Not open for further replies.

krammer

IS-IT--Management
Jul 15, 2007
59
US
Any idea's on how to make these statements any shorter?

Code:
strDrive = iMBS.DBPath
strDrive = (Left(strDrive,1))
strDrive = Replace(strDrive, strDrive, strDrive & "$")
strPath = iMBS.DBPath
strPath = Right(strPath,Len(strPath)-2)
strNetPath = strDrive & strPath
 
I cut it down to 4 lines...

Code:
strDBPath = iMBS.DBPath
strDrive = Replace(strDBPath, Right(strDBPath,Len(strDBPath)-1), "$")
strLocal = Right(strDBPath,Len(strDBPath)-2)
strNetPath = strDrive & strLocal
 
Ok I don't know why I was making this so complicated...all I had to do was replace a colon!

Code:
strLocalPath = iMBS.DBPath
strNetPath = Replace(strLocalPath, ":", "$")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top