Subject Master/Detail Problem in TIBOQuery
Author Oliver Wurdak
Hi All,

I have tried to make a report (with Report Builder 6.02) but I think IBO
causes the error.
The master Query is
SELECT APAID,APNUMM,APMWST,APTYP
FROM AUPOS
WHERE APAID=:AID
ORDER BY APNUMM

APAID;APNUMM is PK in AUPOS
APAID is set in code

The Detail Query is
SELECT APTTID,APTTANUMM, APTNAME1, APTMENGE, APTPREIS, APTRAB
FROM APTAT
WHERE APTAID=:APAID AND APTAPNUMM=:APNUMM
ORDER BY APTTANUMM

APTTID is PK in APTAT

the master-detail connection works because i could browse through the master
table and the detail-rows are correct (I test this with 2 TDBGrids)
but when I try to print the report a 'Record not found' error occurs

I think this error is IBO-related because the SQL-Monitor shows me the
following:
IBO creates 3 statements to retrieve values from APTAT

SELECT APTTID,APTTANUMM, APTNAME1, APTMENGE, APTPREIS, APTRAB
FROM APTAT
WHERE APTAID=? /* APAID */ AND APTAPNUMM=? /* APNUMM */
ORDER BY APTTANUMM ASC

This is OK, it´s my detail-query

SELECT APTTID,APTTANUMM, APTNAME1, APTMENGE, APTPREIS, APTRAB
FROM APTAT
WHERE APTAT.APTTID=? /* BIND_0 */

i understand this too because APTTID is the PK in APTAT (perhaps an
locate-method creates this statement)

SELECT APTAT.APTTID
FROM APTAT
WHERE APTAT.APTTID=?
AND APTAID=? /* APAID */ AND APTAPNUMM=? /* APNUMM */

I don´t understand who creates this statement
the error occurs here because the statement is executed with
PARAMS = [ Version 1 SQLd 3 SQLn 3
APTAT.APTTID = 9028
[AID] = 2359
[APNUMM] = '02.' ]

but the row with APTAT.APTTID = 9028 has APNUMM='01.' !?

I use IBO 4.2Fb, D5, IB6

Best Regards,
Oliver Wurdak