TAB not working in form fields

K

Karen

I've created a form that contains a number of tables, each of which has a
heading. I have spilt the form into two two sections. The first section
contains drop down lists and gives a message "You may only fill in forms in
this region". when protected The second section is for free editing and gives
the message "You may freeley edit this secxtion" when protectd. So far so
good.

When using the first section of the form, the TAB key moves from one field
to the next (which is great). When using the second section of the form, the
TAB key adds a row to the table instead of moving to the next Text Form Field
and pressing the down arrow key moves to the next heading as opposed to the
next form field (in the table underneath the heading).

How do I make the TAB key not add rows (user should be able to add and
delete rows manually if required) and move to the next form field please?
 
D

Doug Robbins - Word MVP

If you have FormFields in the second section of the document, you will need
to protect it for Filling in Forms as well if you want the Tab key to move
from one FormField to the next.

If you then need to give the user the opportunity to add a row, you will
need to add the following macro to the template and set the Addrow macro to
be run on exit from the last formfield in the last row of the table:

Sub Addrow()
Dim rownum As Integer, i As Integer
Dim Response
Response = MsgBox("Do you want to add another row?", vbYesNo + vbQuestion,
"Add Row?")
If Response = vbYes Then
With ActiveDocument
.Unprotect
With Selection.Tables(1)
.Rows.Add
rownum = .Rows.Count
For i = 1 To .Columns.Count
ActiveDocument.FormFields.Add Range:=.Cell(rownum, i).Range,
Type:=wdFieldFormTextInput
Next i
.Cell(rownum, .Columns.Count).Range.FormFields(1).ExitMacro =
"Addrow"
.Cell(rownum, 1).Range.FormFields(1).Select
End With
.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
End With
End If
End Sub


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 

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