Why does this not work?

N

Newbie

Hi
I have the following SQL string that I pass to SQL 2000 using a command but
I get the error -2147217900 - The column prefix 'A' does not match with a
table name or alias name used in the query.

Here is the string
Select StockCode From InvMaster A Where WarehouseToUse = 'P' AND StockCode =
'016430004' and not exists (Select Distinct M.StockCode from InvMovements M
inner join InvMaster I On M.StockCode = I.StockCode And I.StockCode =
A.StockCode Where EntryDate >= '30/09/2002') Order By A.StockCode

If I put this is SQL Query Analyser it works ok - what am I doing wrong

I call this using

with cmdStock
..activeconnection = cn
..commandtext = strSQL
..commandtype = adCmdText
end with

set rsStock = cmdStock.execute
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top