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

[Help] SetFocus method

Alias90
P: 23
Hi Everybody!

Maybe this is stupid question.'Cause i am newbie in Access.
I had a problem with setfocus method.In textbox_AfterUpdate Event(txtkanban_AfterUpdate), i coded :
Expand|Select|Wrap|Line Numbers
  1. Me.txtkanban=""
  2. Me.txtkanban.SetFocus
However, the cursor removed to the another commandButton(cmdEdit)
in design form, tab order i chosen :
1.txtkanban
2.txttong
3.cmdEdit

Thank U in Advance
Jul 25 '12 #1
Share this Question
Share on Google+
3 Replies


twinnyfo
Expert Mod 2.5K+
P: 3,210
Alias90,

I am unable to duplicate your results.... Are you sure that the TabStop property for txttong and cmdEdit are set to yes? This could be your problem....
Jul 25 '12 #2

Alias90
P: 23
twinnnyfo!!! Thank u so much
I'm sorry.Yes, i had mistake. I have chosen 1.txtkanban 2.cmdEdit 3.txttong. But when i chose again 1.txtkanban 2.txttong 3.cmdEdit . the cursor move to txttong. So my purpose is cursor move to txtkanban again. So i don't know to sovle it now. Somebody help me,pleaze!
Jul 26 '12 #3

twinnyfo
Expert Mod 2.5K+
P: 3,210
Alias90,

Hmmmmmmmm. Part of me wonders why you would have code like this, to enter a value into a text box, then simply clear it out after you enter it? I can speak with certainty, but it appears that once you update a control, you can't simply reset the focus to it, you must set it elsewhere first. This would not be the first quirky aspect of Access.

I know a workaround is to set the focus to another control, then set it back to the original control. Which works, but from a programmer's standpoint, is mindless....

If the only goal in this is to clear the contents of txtkanban and set the focus to that control, this will work, but still unsure of the purpose.

See below:

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3.  
  4. Private Sub txtkanban_AfterUpdate()
  5.     Me.txtkanban = ""
  6.     Me.txttong.SetFocus
  7.     Me.txtkanban.SetFocus
  8. End Sub
  9.  
Hope this solves your problem.....
Jul 26 '12 #4

Post your reply

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