Matching Inv & Credit Note

G

Guest

Hi

I have a table with the following fields Code, Date, Amount, URN
it is an extract from our accounting system. Code is the supplier code and
URN is the Unique Reference Number.

I would like to be able to run a query which would identify invoices which
have paid but then have been reversed off again. For example there could be 2
payments for a certain supplier one week but one of them could have been
reversed for some reason. Basically the Code would be the same for both
invoice, URN would be different and amount would be the same but a negative
number. Can someone suggest a way of accomplishing this?

Thanks
 
J

John Spencer (MVP)

The following may do what you ask. Obviously Replace "Table" with the actual
table name


SELECT Table.URN, Table.Code, Table.[Date], Table.Amount
FROM Table
WHERE URN IN (
SELECT URN
FROM Table as C1 INNER JOIN Table as C2
ON C1.Code = C2.Code
WHERE CCur(C1.Amount) + CCur(C2.Amount) = 0)

This may have errors if the Amount field is not always filled in
 
G

Guest

Thanks John....worked perfectly.

John Spencer (MVP) said:
The following may do what you ask. Obviously Replace "Table" with the actual
table name


SELECT Table.URN, Table.Code, Table.[Date], Table.Amount
FROM Table
WHERE URN IN (
SELECT URN
FROM Table as C1 INNER JOIN Table as C2
ON C1.Code = C2.Code
WHERE CCur(C1.Amount) + CCur(C2.Amount) = 0)

This may have errors if the Amount field is not always filled in

Edgar said:
Hi

I have a table with the following fields Code, Date, Amount, URN
it is an extract from our accounting system. Code is the supplier code and
URN is the Unique Reference Number.

I would like to be able to run a query which would identify invoices which
have paid but then have been reversed off again. For example there could be 2
payments for a certain supplier one week but one of them could have been
reversed for some reason. Basically the Code would be the same for both
invoice, URN would be different and amount would be the same but a negative
number. Can someone suggest a way of accomplishing this?

Thanks
 

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