Setting the focus after data entry

  • Thread starter Thread starter Andrea Martin
  • Start date Start date
A

Andrea Martin

On a laptop with no mouse, I have a form with a text box and a command
button. What I want is for students to scan their ID card into the text box,
then press the command button to create a new record & reset the focus to
the text box.

As it works now, students scan their 7 digit IDs into the text box. Then
they have to press the enter key TWICE to a) move from the text box to the
command button, b) create a new record & reset the focus to the text box.

Is there any way I can eliminate a) above? I'd like for students to just
scan their ID numbers and hit enter (the command button) once.

I could just label the command button "Press Enter Twice!" but I'd like a
one-touch button for our busy, easily-confused students.

My code skills are a null value. I used the command button wizard to add a
new record, and looked up in a book how to reset the focus to the text box.
So step-by-step simple instructions would be most appreciated!

Thanks very much,
Andrea
 
in your commandbutton code, add this to the end of the code
yourtextboxname.setfocus

yeah. that simple.
good luck
 
Hey anon,

Shouldn't that go in the text box properties though? I want the focus
to shift to the command button after I enter data in the text box.

Thanks for your prompt reply.

Andrea
 
Is there any way I can eliminate a) above? I'd like for students to just
scan their ID numbers and hit enter (the command button) once.

If all the ID's are the same length in bytes, set the length of the
table field to match, and set the AutoTab property of the textbox to
True.

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
Hey anon,

Shouldn't that go in the text box properties though? I want the focus
to shift to the command button after I enter data in the text box.

You can put the setfocus line in the textbox's AfterUpdate event (if
the autotab doesn't work as you wish).

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
Back
Top