your links should pass the id using an APID or PPID url variable:
detals.asp?APID=12
or
detals.asp?PPID=23
in the recordset, use the advanced screen, set the where clause to:
WHERE APID = paramAPID OR PPID = paramPPID
create 2 parametters as:
Name: paramAPID
type: integer
default value: -1
Run Time Value: Request.QueryString("APID")
Name: paramPPID
type: integer
default value: -1
Run Time Value: Request.QueryString("PPID")