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

What criteria do I use to remove numbers in front of a word? 1

Status
Not open for further replies.

mlrmlr

Technical User
Mar 17, 2006
168
US
Hello,

I would like to remove all numbers before the dash "-" using a query. For example, I have a field that has "036-WONUM" and I would like to output just "WONUM" and remove th numbers and dash in front of the word.

What criteria can I use to get my results?

Appreciate your help. Thanks.
 
You may try an expression like this:
Expr1: Mid(yourField,1+InStr(yourField,"-"))

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hi PHV,

Can I use this expression in the Criteria section of my query?
 
No, in a Field cell of the query grid.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hi PHV,

I added "WO: Mid(WON,1*InStr(WON,”-“))" to the field grid and I get this error.

Cingular reference caused by alias “MSC” in query destination’s SELECT list.

I do have two joined tables in my query. I don't know if that may be the issue.
 
What are MSC and WON ?
What is the SQL code of your query ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Here is my query.

SELECT Mid([WON],1*InStr([WON],[”]-[“])) AS WO, WO_EOS.Vendor, WO.Region

FROM WO RIGHT JOIN WO_EOS ON WO.WON WON = WON_EOS.WON;

I accidently sent you the error message from another query (MSC) I was testing, but the error is the same with the query above.
 
You may try this:
Code:
SELECT Mid(WON_EOS.WON,1+InStr(WON_EOS.WON,'-')) AS WONUM, WO_EOS.Vendor, WO.Region
FROM WO RIGHT JOIN WO_EOS ON WO.WON = WON_EOS.WON

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Yaaaaa! It worked.

Thank you so much for your time and support on this frustrating issue. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top