FormField.select selects wrong field

S

SGagnon

Greetings, All:

I have a Word form that contains several tables with formfields inside table
cells.
A few of the formfields have OnExit macros associated with them that check
the
values in the formfields and if necessary, navigate the user to a formfield
that is not
in the natural tab order of the form.

When changing the targeted next field, the OnExit macros reference the
targeted field
by name, eg:

ActiveDocument.Formfields("txtNextField").Select

My form was working properly this way (or at least it appeared to be) up
until this morning.

Now every time the OnExit macro redirects to a different formfield, it is
not the specified
field which ends up selected. It is the one immediately after the specified
one.
While running the form, it appears that the correct formfield is selected
momentarily. But
then it is as if Word is processing the tab key again and moving to the next
field.

What did I do to confuse Word? .. I have been experimenting with
adding/removing table rows
containing formfields on the fly with an Ole button, and I have been
successful there.. but now
I seem to have broken something. One thing I am doing as I add a new table
row is to always
name the formfield the same thing... so if I add several rows, I now have
several formfields with
the same name. This sounds like a bad thing, I know.. So I have deleted the
offending duplicates
but still the OnExit problem persists.

My questions are:
1. Most important: How can I repair the OnExit problem, and
2. Is the source of the problem the on-the-fly additions, and how can I
prevent this problem from
happening again?

Thanks for reading--

Suzanne.
 
S

SGagnon

After retracing my steps, .. it looks like everything works until I add an
ole control to the form. Even if I don't add any code to the control! Just
the presence of the control in the form makes all of those FormField.Select
calls go to the wrong field.

Is there any way around this?

Thanks..
S.
 
P

Peter Hewett

Hi SGagnon

In brief FormFields and ActiveX controls don't work well together. If you need
to set the tab order I'd stick to one or the other and not try and mix them.

HTH + Cheers - Peter
 
S

SGagnon

Thanks.. that does help. That brick wall was starting to make my head hurt.
:)
-Suzanne.
 

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