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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

InStr function

Status
Not open for further replies.

Steven547

Technical User
Joined
Sep 15, 2004
Messages
165
Location
US
Hi everyone. Just need a quick help solution here please.
I have a field: Department
I want to trim out the: "LDRPS: " from the beginning of each record. So right now, they are shown as: LDRPS: Company. I would like it just to be "Company".
I'm having a problem with my InStr function. Am I doing something wrong that it is only returning a number instead of the name?

InStr([Department],"LDRPS: ")

thanks.
 
InStr tells you the position of the characters you ask for, so it will always give you a number.

Does the DEPT field always begin with "LDRPS: "?? Is it uniform and unchanging??

If so, then this should work:

Code:
Mid([Department], 8)

=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
VB.NET Programmer
 
What about this ?
Replace([Department], "LDRPS: ", "")

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Does the DEPT field always begin with "LDRPS: "?? Is it uniform and unchanging??"

Not all the records begin with the LDRPS.
 
Did you try my suggestion ?
 
PHV's suggestion should work for you if you don't have a uniform format.

=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
VB.NET Programmer
 
Sorry took so long to reply. Yes, I tried PHV's suggestion and it worked like a charm! Thank you for all your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top