View Single Post
  #2   Report Post  
Jay Freedman
 
Posts: n/a
Default

On Wed, 25 May 2005 11:34:02 -0700, Mary Sasiela
wrote:

When I have a single character form field, I still must TAB to the next
field. Short of creating a macro, is there a way to advance the active cell
cursor to the next single character field without hitting tab?

For example - one of the fields is for date. So there are 9 single
character fields - dd MON yyyy. User would like auto-advancement to the next
character without having to TAB.

Any ideas are appreciated. I do LOADS of these forms.


There's no way to make this work with form fields in the body of a
protected document. Form fields simply don't respond that way.

The alternative is to redo the form as a userform (a custom dialog);
see http://www.word.mvps.org/FAQs/Userfo...eAUserForm.htm for a
simple tutorial. To the code in the userform shown there, add a
procedure like this one for each field that should accept one
character and then jump to the next field:

Private Sub TextBox1_Change()
If Len(Trim(TextBox1.Value)) 0 Then
TextBox2.SetFocus
End If
End Sub

This procedure automatically runs each time the content of the field
changes. It says that if the box is not empty and the character is not
a space, then the cursor moves to the next field.

Just out of curiosity, why do you have each character in a separate
field? Why not three fields, one each for day, month, and year? (It's
a valid way to represent the date, but it makes more work for whatever
code has to check that it's a real date.)

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org