By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,067 Members | 1,227 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,067 IT Pros & Developers. It's quick & easy.

Preventing a control from losing focus

P: 10
I am currently working on a project where I am using a bar code scanner that enables people to scan their employee ID and another bar code from a piece of paper. The scanner scans the code to a text box that has focus. However afterwards the text box loses focus and I can't set the focus to the text box in its lostfocus() event.

Any ideas how to do this?

I am working with Microsoft Access 2003.

Any help would be greatly appreciated.


Nov 14 '11 #1
Share this Question
Share on Google+
3 Replies

P: 10
Post was not needed, found a solution to the problem that i had previously overlooked
Nov 14 '11 #2

P: 10
For anyone interested I have figured out a solution to this issue.
It's rather simple but i makes my system work :-)

I added an invisible control to the form and made it next in the tab order after my input text box. Under the "On Got Focus" of this control i made it return the focus to my input text box. This way I can still use my other controls while maintaining focus on that text box after someone enters a value into it.


Nov 14 '11 #3

Expert Mod 15k+
P: 31,709
I wonder if you considered adding your code to the control that was already next in the sequence rather than having to add a new, invisible, control just for that purpose.

Also, have you considered mouse usage? The mouse can click on any control that can take the focus. If you want to disallow this then each such control needs the same code associated with it.

You may also want to consider the .TabStop property of the other controls.
Nov 14 '11 #4

Post your reply

Sign in to post your reply or Sign up for a free account.