problem w/ set focus

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form in which I'm setting focus to a command button in code. The
button is visible, not locked, and enabled. When I execute the line in code
to set focus, I get an error that says I can't set focus to the control. Odd
thing is that this code worked on this form for several months. Gremlins?
 
99% of the time when I hear this complaint the final answer is that the
"command button" is not actually a command button, but rather a label whose
Click event is being used, and labels cannot receive focus! If that's not it,
my next guess would, indeed, be gremlins!
I have a form in which I'm setting focus to a command button in code. The
button is visible, not locked, and enabled. When I execute the line in code
to set focus, I get an error that says I can't set focus to the control. Odd
thing is that this code worked on this form for several months. Gremlins?

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

Message posted via AccessMonster.com
 
Hmmmm, it has been my experience that you cannot set the focus to an
invisible command button, nor can you set the visible property to false for
a command button that has the focus.
If your form has worked with this code for several months, the code
apparently was never invoked until now.

UpRider
 
Has something recently hanged? Did you upgrade to a different version of
Access? What is your code?

Post back with some more info and someone may be able to help you.
 
Verry interesting. When I run the code in Access 2003, it works. The
problem appeared in Access 2002 after one of a number of updates. Don't know
which one. Any other ideas would be appreciated very much. Also, this app
is an adp. All the mbd's work ok in this respect.
 
1. Nothing hung up. DB gets decompiled, compacted and repaired regularly.
2. Code doesn't work in Access 2002, but 2003 is ok.
3. Code looks like me.cmdButton.SetFocus
THanks
 
Back
Top