Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Working with controls and backspace key.

Status
Not open for further replies.

JHT1

Programmer
Mar 16, 2005
3
0
0
US
How do I get textbox control to recieve the focus by a click the mouse on the control/textbox? have use setFocus in the on Exit function of the textbox. Each time I press the enter key, the cursor goes to the next box.......this is good. Now when ever I want to click back into the very box from which it came from, it doesn't. It continue executing the setfocus I have in each textbox "on exit function". How can I get to have my cursor click anywhere I want to.
Here is the code I have in the On-exit function in each textbox.
Private Sub txt11MfgID_Exit(Cancel As Integer)
txt11MfgID = Format(txt11MfgID, "000000000")
'Set focus of mouse to next input field
txt11BrandID.SetFocus
End Sub
 
Try using View TabOrder (= "z order") to set the sequene of controls instead of code.

Regards
BrianB
Use CupOfCoffee to speed up all windows applications.
It is easy until you know how.
================================
 
Hi JHT1,

Maybe Brian's answer is the one you need. If not, what application are you using?

In Access Forms, your SetFocus will work (although you'll never know!) but will be overridden by the focus being shifted to the control you're moving to.

I don't quite understand your example. Are you trying to force a particular textbox on the user, even if they click on a different textbox? If so, I must ask why, what will you gain?

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
Thanks Guys,
BrainB that method surely work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top