hi
I am running some queries in VB6 using ADO from an Access d/b.
I run one query, then another to compare to the other query and add/amend records, then want to run a 3rd query to add further information.
The problem is that the third query is not returning the expected results.
The SQL is to return the last payment date and amount for each client....
SELECT T.[Invoice date] AS InvoiceDate, T.[Amount in currency] AS Amount
FROM Transactions AS T
WHERE T.[Invoice date] IN
(
SELECT MAX([Invoice date])
FROM Transactions
WHERE ([Procedure ID] = 9 OR ([Procedure ID] = 8 AND Details LIKE '*payment*'))
AND [Amount in currency] <> 0
AND [Currency abbreviation] <> 'IGN'
AND [Invoice date] < #10/23/2007 23:59:59#
AND [Client ID] = 409382903
)
AND T.[Client ID] = 409382903
(this is one of many different ways of getting the data that I've tried)
Works fine in Access but get a different result from within VB?
As the SQL obviously works is there something stopping the correct records being found?
Wayne
I am running some queries in VB6 using ADO from an Access d/b.
I run one query, then another to compare to the other query and add/amend records, then want to run a 3rd query to add further information.
The problem is that the third query is not returning the expected results.
The SQL is to return the last payment date and amount for each client....
SELECT T.[Invoice date] AS InvoiceDate, T.[Amount in currency] AS Amount
FROM Transactions AS T
WHERE T.[Invoice date] IN
(
SELECT MAX([Invoice date])
FROM Transactions
WHERE ([Procedure ID] = 9 OR ([Procedure ID] = 8 AND Details LIKE '*payment*'))
AND [Amount in currency] <> 0
AND [Currency abbreviation] <> 'IGN'
AND [Invoice date] < #10/23/2007 23:59:59#
AND [Client ID] = 409382903
)
AND T.[Client ID] = 409382903
(this is one of many different ways of getting the data that I've tried)
Works fine in Access but get a different result from within VB?
As the SQL obviously works is there something stopping the correct records being found?
Wayne