can't hide control that has focus

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

Guest

Hello out there!

I have a continuous form that displays a number of rows and a total at the
bottom. There are times that I want to use this form for display purposed
only, and other times that I want to allow the user to enter a number in a
text box and click on a button to proceed.

I want to hide the text box and the button when the form is used for viewing
only, however, since these are the only controls on the form that are not
locked, when I try to set the textbox visible property to false, I get an
error message saying that I can't hide a control that has the focus.

So my question is this... how can I set the focus to a different control on
the form when all the other controls are locked?

Any help would be greatly appreciated.
 
Logically, your form requires something else that can take focus, e.g. a
minute text box or transparent button. You can then SetFocus to that object
before you hide the other controls.
 
Thanks... that's a good idea, and it makes logical sense to me.

Acutally I got it fixed. I'm not completely sure I understand why this
worked, but here's what I did. Originally the form was set up to filter the
records on the open event. That seemed to be triggering the problem. Not sure
if the act of filtering set the focus to that text box or what.

Anyhow, I took the filter out of the open event and just filtered the
records in the line of code that opens the form. After I did that it happily
let me hide the controls and open the form for viewing only (eventhough all
of the visible controls were locked and not enabled). I don't know what it
means, but I'm glad that it's working.

Thanks again for your suggestion!
Rebecca
 
Back
Top