Force users to use the enter key

P

Peter Castlehouse

Hello all,

Hope your day has been or will be as good as mine has been so far!

Is this one possible?

I am trying to trap if a user is swapping between the keyboard and the mouse
when completing a data entry form, and if they are (to navigate to the next
field) encourage them to use the keyboard, much the same as they would when
word processing.

Example : includes fields [firstname] and [surname]

User enters First name in [firstname]

(then selects to navigate to [surname] using the mouse, instead of
pressing enter...
which obviously entails hand leaving the keyboard, locating the mouse,
finding the mouse
pointer on-screen, then clicking the [surname] field! PHEW! )

Msgbox "This is your friendly programmer here. Press enter, don't use the
mouse ya goose!", vbexclamation

I would of course come up with a more friendly message than the one above,
and I hope you get my drift.

TIA

DubboPete
basking in 27ºC spring - (SIA - sorry in advance!)
 
P

Peter Castlehouse

Hi all,

I just worked it out! d'oh

In any field but the one I am leaving, I can add this to the 'On MouseDown'
event

msgbox "don't use the mouse!"
me.field_that_person_has_clicked_on.setfocus

cheers anyway all
DubboPete
 
P

Peter Castlehouse

Ermm...

It's back and LIVE... please ignore my erroneous posting about having a
cure! d'oh Using the OnMouseDown event triggers each time I move the
mouse, so it pops up the MsgBox every time I touch the mouse! All I was
thinking of was if any other field was clicked with the mouse, after the
previous field was updated.

So basically it's triggered with the On Exit or On Lost Focus event of a
field AND the mouse was used to trigger that action, THEN trap use of the
mouse and display friendly message... clear as mud hey?

Anyone got any logical solutions? not the garbled mess I am creating
here!!!

DubboPete :)
 
D

DubboPete

Almost there...

There's something I am missing here, but it works for everything INCLUDING
the [enter] key!

Private Sub FIRST_NAME_Exit(Cancel As Integer)
If KeyPress <> vbEnter Then
Me.SURNAME.SetFocus
Else
MsgBox "HEY! Press the [ENTER] key next time... it's quicker :) ",
vbInformation
Me.SURNAME.SetFocus
End If
End Sub

I actually thought that if I used anything but the enter key it would just
go to the next field. Not so.
I can use the mouse, the message appears, and then it goes to the next
field. Perfect
I press the enter key, the message appears, and then it goes to the next
field! Not Good!

discuss please?

DubboPete
ps, hey, at least I get 5 out of 10 for dogged determination huh?
 

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