Events not firing in subform

G

Guest

I am using Access 2002 (ADP with SQL Serever) with a main form, containing
tabs. Two of the tabs contain subforms. I am trying to ensure that the user
cannot add data in the subform if the main form is in add mode, because there
is no ID field (from the main form) to relate to. So I tried using subform
controls on enter event. It works, but only the first time it is used. So I
can disable the subform then, but I cannot re-enable it. The events on the
actual subform (like Activate, Enter and GotFocus), but those don't seem to
fire at all, or at least not reliably as far as I can see. Is there a reason
why these events don't fire on a subform? Could it have something to do with
the Tab control I wonder?

Thanks,
nickpup
 
S

Stephen Haley

If you use the events associated with the subform (Enter & Exit) you
shouldnt have a problem. From what you say it sounds like you are using the
Form events of the subform. IE Make sure the code appears against the
subform in the module of the main form not in a module associated with the
subform. I would have thought that you could couple the Main Form After
Update, Load and subform enter & exit events to create a workable solution.
An alternative is to use the gotfocus event on the first control in the
subform which will always fire when a user enters the subform
The activate & focus events dont work for a subform
rgds
stephen
 

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