It’s been a while since I last raised a question, which was this one:
After using the application I built for more than 750 “Efforts” (see the above link for a description) I’m looking for the best way to solve the clumsy listbox issue. Limiting the listbox, as planned previously, won’t work well while still allowing for errors when clicking the wrong listbox item.
So I created this nice query
SELECT MAX( "tEffort"."effortID" )
FROM "tAssignment", "tCampaign", "tEffort", "tProspect"
WHERE "tAssignment"."campaignRef" = "tCampaign"."campaignId"
AND "tEffort"."assignmentRef" = "tAssignment"."assignmentID"
AND "tAssignment"."prospectRef" = "tProspect"."prospectID"
AND "tCampaign"."campaignId" = :campaign_id
AND "tProspect"."prospectID" = :prospect_id
which works pretty well – outside the table control showing all efforts for the particular prospect and the particular campaign, that is. Now I would like to enter a new effort by clicking the ‘+’ in front of the next empty line in the table control, showing the history of efforts.
Question A: Is there an event triggered by clicking that ‘+’ of the table control?
This event should trigger a macro which runs above query and inserts the result into the table column “VorID”. Additional fields will be filled in manually, and when saving the row, the ID will be autoinserted by the db. This way I would have always the proper “PreID”. Maybe it would be even smarter to fetch the MAX(tEffort.effortID) only within the INSERT statement, but this raises
Question B: How can I write and trigger a macro which runs my variant of the insert code?