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

Right or Trim Function Help!

Status
Not open for further replies.

mmck1964

Technical User
Jul 12, 2001
104
US
I need help with trying to use a RIGHT or TRIM function in a QUERY. I have a a LOCATION field with utility pole numbers on them and I want to remove the letters on the right back to the first space. Here are some examples of the data.

[LOCATION] [NEEDED]
PA 109S 55W 2N 1A PA 109S 55W 2N
WC 155A WC
PB4 68N 1UNH PB4 68N
B 3E 1P B 3E
XB1 203S 14W 2N 6PU XB1 203S 14W 2N

Thanks!
 
How about:

[tt]strS1 = "PB4 68N 1UNH"
strS2 = Mid(strS1, 1, InStrRev(strS1, " "))[/tt]
 
That worked great, but due to some errors in my data, could the letters on the end be removed to return the following?

LOCATION] [NEEDED]
PA 109S 55W 2N 1A PA 109S 55W 2N 1
WC 155A WC 155
PB4 68N 1UNH PB4 68N 1
B 3E 1P B 3E 1
XB1 203S 14W 2N 6PU XB1 203S 14W 2N 6
Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top