Form Field Navigation

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello!

Is it possible to "force" users to use the tab or enter key to navigate
through a form? I want the user to go through EVERY field on the form and
fill out each field before going to the next. I do not want them to be able
to use their mouse to go from the first field to the fourth.

Any suggestions?
 
Dear Rani:

I don't know how much the users will like this approach, but it should not
be hard to do.

I would write a function that tests each of the controls, in order, to see
that they have a valid entry. This test should stop when it reaches the
control the user has selected (perhaps with a mouse).

If the user attempts to access, say, the 8th control, it would first test
controls 1-7 for valid entry. If any of them does not have a valid entry,
move the focus to that one.

With a good effort, a single procedure should be able to do this. It would
be called upon entry into each of the controls in this list.

Tom Ellison
 
Rani said:
Is it possible to "force" users to use the tab or enter key to navigate
through a form? I want the user to go through EVERY field on the form and
fill out each field before going to the next. I do not want them to be able
to use their mouse to go from the first field to the fourth.


I don't know how, but even if there might be a way to do
that, but I don't think it's a good idea. Let the users
enter the data in whatever way makes sense to them. Your
requirement is that they must enter something (anything?) in
every field.

This is best handled by using the form's BeforeUpdate event
with VBA code to check to missing (or illegal) values. I
think I would do this by setting the Tag property of each
bound text box to something like "Required" and using code
like:

Dim ctl As Control
Dim strCtlList As String
For Each ctl In Me.Controls
If ctl.Tag = "Required" Then
If IsNull(ctl) Then
strCtlList = strCtlList & ", " & ctl.Name
End If
End If
Next ctl
If strCtlList <> "" Then
MsgBox Please enter a value for Mid(strCtlList, 3)
Cancel = True
End If
 
Back
Top