hello jm,
I am also an accountant, but more of a computer geek than an accountant I would say. Just finishing up the masters work in for an MSA.
But at any rate, this is an interesting problem. After tinkering with it, thinking that one query would work became a little too tough. So in a double-stacked query scenario, here's one solution:
QUERY1:
[CODE]SELECT table.[code], table.[trans]
FROM table
WHERE (((table.[trans])=-Abs([trans])) AND ((InStr(QUERY2:
[CODE]select table.* from table where
(dcount("code", "QUERY1", "[code] = '" & [code] & "' & 'x'") = 1
AND dcount("trans", "QUERY1", "[trans] = " & -abs([trans]) & "
AND [code] = '" & QUERY 3 (Final):
[CODE]DELETE table.* FROM table WHERE
((code in (select code from QUERY2) and trans in (select trans from QUERY2)) OR
(left([code], len(
Code:
) - 1) in (select code from QUERY2) AND
([trans] + (abs([trans]) * 2)) in (select trans from QUERY2)))
There's obviously a better way than this somewhere. One way would be to write a small vb procedure, but most people don't write code. So going step by step through the query process would probably yield something like this anyway.