I cannot get my code to work. I am fairly new to visual basic. I just want to remove the parentheses out of about 25,000 fields from a query that I am basing off of a warehouse table. See thread705-1277401 for full explanation. Some of the records have parentheses and some don’t. I am creating a function and placing it in the query and I cannot get it to work.
I want these results:
2604-(26X03) should be 2604-26X03
4610-(96719) should be 4610-96719
5618-(5025) should be 5618-5025
2103-(95108) should be 2103-95108
5622-12 should be 5622-12 (unchanged)
5628-3 should be 5628-3 (unchanged)
4402-881 should be 4402-881 (unchanged)
This is the code that I have written and I have placed this function in the query:
Option Compare Database
Public Function NewParse(SP_NBR As String) As String
Dim NS As String
NS = SP_NBR
NS = Replace(Replace(NS, "(", ""), ")", "")
NewParse = NS
End Function
I want these results:
2604-(26X03) should be 2604-26X03
4610-(96719) should be 4610-96719
5618-(5025) should be 5618-5025
2103-(95108) should be 2103-95108
5622-12 should be 5622-12 (unchanged)
5628-3 should be 5628-3 (unchanged)
4402-881 should be 4402-881 (unchanged)
This is the code that I have written and I have placed this function in the query:
Option Compare Database
Public Function NewParse(SP_NBR As String) As String
Dim NS As String
NS = SP_NBR
NS = Replace(Replace(NS, "(", ""), ")", "")
NewParse = NS
End Function