Advertisement

06.30.2008 at 11:02PM PDT, ID: 23529195
[x]
Attachment Details

Use of Split function in SQL statement

Asked by angie_angie in SQL Query Syntax

Tags: MS Access, VBA

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
[+][-]07.01.2008 at 12:45AM PDT, ID: 21905594

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: SQL Query Syntax
Tags: MS Access, VBA
Sign Up Now!
Solution Provided By: MikeToole
Participating Experts: 1
Solution Grade: A
 
 
[+][-]07.02.2008 at 02:36AM PDT, ID: 21914660

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 - Hierarchy / EE_QW_2_20070628