So far my Form - SubForm - SubSubForm stuff works pretty well. Now I have yet to solve one more issue which is beyond my knowledge. Given is this set of tables:
These (and some more) are presented in this form:
Everything works fine as it is, however, to make the self reference in tEffort table work (tEffort.effortID = tEffort.effortRef) the user has still to enter the effortRef value in the SubSubForm (which is child to the tAssignment SubForm which is child to tProspect Form). The previous Effort ID is shown at the far left, 209 in this case. Now the user has to select 209 from the listBox to properly connect the most recent effort to the chain of efforts. This works reasonably well, but with the growing number of efforts, the list gets quite long, and, even worse, wrong numbers, pointing to different prospects/efforts, may get entered involuntarily.
My intended solution was to limit the list of values in the listbox to only effortIDs which relate to the prospect shown. But somehow I can’t figure out how to limit the effortIDs to the prospect. In a query, it’s no problem to get what I want, f.e. for prospectID = 13:
SELECT "tEffort"."effortID"
FROM "tEffort", "tAssignment"
WHERE "tEffort"."assignmentRef" = "tAssignment"."assignmentID"
AND tAssignment.prospectRef = 13
ORDER BY "tEffort"."effortID" DESC
But I can’t figure how to make this work in a SubSubForm (accessing tAssignment.prospectRef in the parent SubForm would be ideal, but …)
Question:
How can I limit the current list of effortIDs to the current tAssignment.prospectRef (or tProspect.prospectID) from within the listbox?
TIA