469,270 Members | 1,117 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,270 developers. It's quick & easy.

Hiding a control in focus on click of another control in ms access 2007?

99
I have a combobox and also a label on the same form.On click of the label, the combobox is to be made invisible.the problem is if the combobox is in focus and the label is clicked, it throws error saying that You can't hide a control which is in focus.I tried setting focus on the label itself when it is clicked but it didn't work.I also tried putting this code I found in one of the discussion forum
Expand|Select|Wrap|Line Numbers
  1. Sendkeys"{TAB}"
  2. DoEvents
it didn't work.
Also tried the following without any result
Expand|Select|Wrap|Line Numbers
  1. Screen.ActiveControl.Name=label1
Mar 2 '12 #1

✓ answered by TheSmileyCoder

You need a visible, enabled textbox (or combo/listbox) to move focus too, before hiding the combobox.

You cannot set focus to a label.

5 1452
Mihail
759 512MB
Move the focus to the form itself before hide the combo box:
Expand|Select|Wrap|Line Numbers
  1. me.SetFocus
Mar 2 '12 #2
HiGu
99
Again: didn't work
same error
Mar 2 '12 #3
TheSmileyCoder
2,321 Expert Mod 2GB
You need a visible, enabled textbox (or combo/listbox) to move focus too, before hiding the combobox.

You cannot set focus to a label.
Mar 2 '12 #4
HiGu
99
Oh. Thanks.I found the similar answer on the site of "msdn" but I was skeptical about it as it wasn't mentioned explicitly.
Mar 2 '12 #5
NeoPa
32,171 Expert Mod 16PB
HiGu:
I found the similar answer on the site of "msdn".
Indeed. It's always a good idea to search for an answer before posting a question. We're happy to answer your questions, but it will save you a lot of time and energy. Also, the more you do that the better able you are to find the best answers.
Mar 3 '12 #6

Post your reply

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

Similar topics

reply views Thread by MattB | last post: by
1 post views Thread by StyrofoamSUV | last post: by
1 post views Thread by Ryan | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.