problem w/ set focus

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?
 
M

missinglinq via AccessMonster.com

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
 
U

UpRider

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
 
G

Guest

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.
 
G

Guest

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.
 
G

Guest

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
 

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

Similar Threads

read focus of controls 1
Set Form Focus 1
SetFocus Problem 1
Focus after DblClick 4
Kill Focus on Subform 2
Focus jumps a control 2
Focus Issue 11
set focus with command button 1

Top