Setfocus to control/form and back.

P

Peter de Putter

Here is my problem:
In Access 97, I have a form that initially opens with only
some image-controls on it. So, the form has the focus.
Then, when the user clicks on one of the images, a set of
controls opens (depending on which image the user clicks),
this is all done in code. The first control in the
TabOrder gets the focus.
When the user clicks another image, another set of
controls becomes visible.
What I want to achieve, is a way to hide all controls,
i.e. a "Clear Form" function. When I try that, Access says
it cannot be done, because the control with the focus
cannot be hidden.
I cannot set the focus to the form, because a form can
only get the focus when there is no visible control on in
it that can get the focus. I cannot set the focus to the
image control, 'cause an image control cannot receive the
focus.
I do not want to use the button control, because that is
ugly with a grafical image in it.

Please help!
Thanks.
Peter de Putter
 
D

Dirk Goldgar

Peter de Putter said:
Here is my problem:
In Access 97, I have a form that initially opens with only
some image-controls on it. So, the form has the focus.
Then, when the user clicks on one of the images, a set of
controls opens (depending on which image the user clicks),
this is all done in code. The first control in the
TabOrder gets the focus.
When the user clicks another image, another set of
controls becomes visible.
What I want to achieve, is a way to hide all controls,
i.e. a "Clear Form" function. When I try that, Access says
it cannot be done, because the control with the focus
cannot be hidden.
I cannot set the focus to the form, because a form can
only get the focus when there is no visible control on in
it that can get the focus. I cannot set the focus to the
image control, 'cause an image control cannot receive the
focus.
I do not want to use the button control, because that is
ugly with a grafical image in it.

Please help!
Thanks.
Peter de Putter

You might put an infinitesimal (height 0, width 0) text box on the form.
Leave this visible at all times -- the user still can't see it. Now you
can send the focus to this text box whenever you want to hide all the
other controls.
 
G

Guest

-----Original Message-----


You might put an infinitesimal (height 0, width 0) text box on the form.
Leave this visible at all times -- the user still can't see it. Now you
can send the focus to this text box whenever you want to hide all the
other controls.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


.
Thank you! Works like a charm!!
Peter de Putter
 

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

Top