Is there Excel descrepancies with SQL strings

deadseasquirrels

Board Regular
Joined
Dec 30, 2004
Messages
232
I've been trying to execute this SQL string for the longest time:
Code:
connString = "Provider=MSDAORA.1;Password=[pwd];User ID=[uid];Data Source=DKARCH1.WORLD;Persist Security Info=True" 
    dbsNDF.connectionString = connString 
    dbsNDF.Open 

    sqlString = "SELECT  SO.PURCHASE.STATUS, SO.STUDENT.ENTRY_DATE, SO.STAFF.USER_NAME, " & _ 
        "SO.PURCHASE.CODE, SO.STUDENT.FIRST_NAME,SO.STUDENT.LAST_NAME " & _ 
        "FROM SO.STUDENT, SO.PURCHASE " & _ 
        "WHERE   SO.STUDENT.ENTRY_USER_ID = SO.STAFF.ID " & _ 
        "AND     SO.PURCHASE.PRODUCT_ID = SO.PRODUCT.ID" & _ 
        "AND     SO.PRODUCT_GROUP.ID = SO.PRODUCT.PROD_GROUP_ID" & _ 
        "AND     SO.STUDENT.SCHOOL_ID = SO.SCHOOL.ID"
and it just doesn't seem to want to work. And I was wondering if there are any ways I have to edit my SQL string to make them work in Excel. I've created strings that worked before but when I stick in other strings, usually longer ones, it always seems to fail. ANy ideas?
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
What's the problem?

Is it causing errors or not producing the correct result?

BTW you're missing a couple of spaces:

sqlString = "SELECT SO.PURCHASE.STATUS, SO.STUDENT.ENTRY_DATE, SO.STAFF.USER_NAME, " & _
"SO.PURCHASE.CODE, SO.STUDENT.FIRST_NAME,SO.STUDENT.LAST_NAME " & _
"FROM SO.STUDENT, SO.PURCHASE " & _
"WHERE SO.STUDENT.ENTRY_USER_ID = SO.STAFF.ID " & _
"AND SO.PURCHASE.PRODUCT_ID = SO.PRODUCT.ID " & _ <-----Here
"AND SO.PRODUCT_GROUP.ID = SO.PRODUCT.PROD_GROUP_ID " & _ <------And here
"AND SO.STUDENT.SCHOOL_ID = SO.SCHOOL.ID"
 
Upvote 0

Forum statistics

Threads
1,214,980
Messages
6,122,563
Members
449,088
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top