SetFocus Issue

C

chammock

I have a form that I am building programmatically with a group of
command buttons. and some labels. I have set the Command Buttons to
have no TabStop, but the first one on the form always has the Focus. I
don't want anything on the form to really have Focus. Can I do this? I
have tried to set focus to a dummy text box with visible = No but
cannot. If I try something like
Forms![frmPanelRightTemplate].SetFocus it still sets it to the first
command button.
 
K

Ken Snell \(MVP\)

If you don't want any of the buttons to have the focus initially, then
create a small textbox with height = 0 and width = 0. Set the focus to that
textbox.

Or put a tiny transparent command button on the form (no code on its Click
event) and set focus to it.
 
R

Rick Brandt

I have a form that I am building programmatically with a group of
command buttons. and some labels. I have set the Command Buttons to
have no TabStop, but the first one on the form always has the Focus. I
don't want anything on the form to really have Focus. Can I do this? I
have tried to set focus to a dummy text box with visible = No but
cannot. If I try something like
Forms![frmPanelRightTemplate].SetFocus it still sets it to the first
command button.

Make your dummy TextBox visible but very small. I usually also tuck these in
the extreme upper left corner because they will be just as hard to see in design
view. This way I can select it because I know where it is.
 

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