Tab Action

A

Angyl

How do you get VB to respond when a user tabs OUT of a field?

I'm going to set up a form using an array to call values based on what is
entered in one text field and I'd like it to happen immediately upon the user
typing in their data and leaving the field, not pressing a button or
anything.

Like when you type in "8810" and press Tab out of the field the next
(non-enabled) text field will show "Clerical Office employees"
 
D

Dian D. Chapman, MVP

You can use the EXIT event for the textbox.

Double click the textbox and then click the dropdown to the right side
of the code window and you'll see the available events. Choose EXIT
and insert your evaluation code there. When the user exits that field,
that even will run.

Dian D. Chapman
Technical Consultant, Microsoft MVP
MOS Certified, Editor/TechTrax

Free MS Tutorials: http://www.mousetrax.com/techtrax
Free Word eBook: http://www.mousetrax.com/books.html
Optimize your business docs: http://www.mousetrax.com/consulting
Learn VBA the easy way: http://www.mousetrax.com/techcourses.html
 
A

Angyl

Thanks, Dian, but allow me to clarify: I don't want this to happen in the
Word Form, with a macro. Rather in the Visual Basic userForm when the data
will be entered.
 
D

Dian D. Chapman, MVP

Yup...I knew that and that's exactly what I mean. Use the EXIT EVENT
for that control. You'll find it where I said it'll be...unless you're
using an older version of Word where that event wasn't available.

Dian D. Chapman
Technical Consultant, Microsoft MVP
MOS Certified, Editor/TechTrax

Free MS Tutorials: http://www.mousetrax.com/techtrax
Free Word eBook: http://www.mousetrax.com/books.html
Optimize your business docs: http://www.mousetrax.com/consulting
Learn VBA the easy way: http://www.mousetrax.com/techcourses.html
 
D

doctorjones_md

Unless I'm completely "off-base" in my understanding of your query, it
sounds like what you need is to modify the Tab Index for each Text Box on
your form -- anyone else feel this is a good solution?

HTH
================================
 
D

Dian D. Chapman, MVP

Well...modifying the tab index wouldn't do anything other than
changing which field gets tabbed into next, right. So if I understand
what YOU are saying, that wouldn't do anything.

I'm understood that she wanted some action to happen as soon as the
user tabs out of a textbox within a user form. So to cause an event to
trigger an action, you have to open that there IS an event that
matches for that control.

And the TextBox control does have an EXIT event, as well as a CHANGE
event, but that would cause something to happen the minute any one
char was typed. And the Mouse events wouldn't work. And there's a
FOCUS event, but I forgot to check if there's a lost focus
event...that could work, too...if there's one. But the exit will cause
the trigger as soon as they tab out. So if I understand the original
problem correctly, that should do the trick.

Dian D. Chapman
Technical Consultant, Microsoft MVP
MOS Certified, Editor/TechTrax

Free MS Tutorials: http://www.mousetrax.com/techtrax
Free Word eBook: http://www.mousetrax.com/books.html
Optimize your business docs: http://www.mousetrax.com/consulting
Learn VBA the easy way: http://www.mousetrax.com/techcourses.html
 

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