My apologies for the tardy response, partiularly after the prompt response.
I thought I had asked a perfectly simple question but the two replies indicate that I have not. Ratsinger has correctly surmized my issue when he says “once you advance to a new row in the sub-table control, that record is updated.” In my case the movement to the new row in the sub-table is precipitated by a movement in the parent table but that is not particularly relevant,
This default behaviour is what I wanted to supress. I only wanted the update (or insertion) to come from an explicit button press.
My problem was one of English language semantics. Suppose a cursor is pointing to the second row in a resultset. I interprested “before record change” to mean “before a change in the contents of the current row”, i.e. the updateRow or insertRow call. However, “record change” actually means movement of the cursor wthin the result set, say to the first or third row. What I needed to do was to write a macro to catche the “before record action” event. This turned out to be non-trivial since the macro is actually fired twice, once with the controller as the source and once with the form.
This is the code I wrote that sort of did the job, but USE IT AT YOUR OWN RISK:
function BeforeRecordAction(event) ' USE AT YOUR OWN RISK
If .supportsservice("com.sun.star.form.runtime.FormController") Then
if .currentcontrol.model.classid = com.sun.star.form.FormComponentType.COMMANDBUTTON then
BeforeRecordAction = true ' Button update OK
BeforeRecordAction = false ' Updates initiated by row movement disallowed
BeforeRecordAction = true ' Not controller so ignore
However, this seems to confuse the BASIC framework, as does trying to veto row movements with “before record change”. It looks like BASIC does not expect you to use event handlers to veto these sorts of things although supressing mouse click and keyboard events seems to be OK.
My advice to any would-be developers that want users to explictly confirm or cancel changes is to either use a dialogue box or write the whole application in Java. If you don’t like either of those options try simplifying the form to exclude subforms and minimizing the extent to which the BASIC framework can get itself confused.