Problem with cancelling Before Update with nested subforms - possible bug ?

C

chris1508

Hi,

I have a main form (main01) that contains a subform (sub01) in
datasheet view. Sub01 also contains a subform (sub02) in datasheet
view and has a + sign to access the data.

Data entered into sub01 is validated in sub01 in the before update
event as validation is dependant on several fields in sub01. If the
validation fails an appropriate error message is displayed and the
before update event is cancelled. All good so far.

A problem occurs if the before update was fired by clicking on a field
in sub02. What happens is the sub01 before update event fires and
cancels the update but the focus is now on the field in sub02.

Any attempt to move the focus back into sub01 from sub02 by clicking
on a field in sub01 fires the before update and cancel for sub01 and
the focus remains in sub02.

Attempting to set the focus to the invalid field in sub01 using VBA
generates Error 2110 "can't move the focus to control".

I'm now stuck with an invalid unwritten record in sub01 but can't move
the focus back into sub01 to correct the invalid field. I've tried
cancelling the on exit event for the subform control on sub01 that
contains the sub02 form but this event never seems to fire.

Any suggestions or help would be greatly appreciated.


Thanks,

Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top