Hi Experts,
Can I use Split function in SQL statement?
I have values in myTblB.aFldInB as a combination of words and numbers with brackets. E.g. "abcdef (123456)". I want to trim the numbers together with the brackets and put only the words into myTblA.aFldInA. So I used the split function in my query with VBA codes like this:
sGetSQL = "UPDATE myTblA INNER JOIN myTblB ON Cstr(myTblA.caseNo) = Mid(myTblB.caseID) " _
& "SET myTblA.aFldInA = Split(myTblB.aFldInB, '(')(0) " _
But error ocurs saying: Invalid use of '.','!', or '()'. in query expression 'Split(myTblB.aFldInB, '(')(0). I tried out the same use of Split function outside SQL like this:
myWords = Split("abcde (1234)", "(")(0)
Debug.Print myWords
and it works fine. Can anyone help to explain why? How to do it correctly?
This is URGENT! Thank you very much!!
Start Free Trial