Removing dotted lines from Command Button

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

Guest

I have a small form with 3 command buttons on it (each opens another form).
Each command button has "no" set for the Tab Stop property. The button with
the Tab Index of zero always has a faint dotted box around the button text.

Is there a way to eliminate this dotted box so all the buttons look "clean?"

Thanks.

Jerry
 
Hi Jerry

Try this:

remove the "default" from the button

make another button:
Default --> Yes
Transparent --> yes

Have it run the same code.

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access
strive4peace2006 at yahoo.com
 
I think this is because the command button has the focus. Something has to
have the focus so if these are the only controls on the form then you might
need to resort to an old trick. Create a textbox with no label. Make this
control the first control in the tab order then set the size of the textbox
to .001 x .001. When the form opens your textbox will have the focus but
since it is too small to be visible you won't even know it's there.
 
Good point, Sandra!

Jerry, another thing you can do is set
TabStop --> no
for your command button so it doesn't get the focus

You should also check the Tab Order:
right-click in the section you want to check and choose Tab
Order from the shortcut menu

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access
strive4peace2006 at yahoo.com
 
Thanks Crystal and Sandra. Crystal's idea was the most fitting and worked
perfectly.

Jerry

Sandra Daigle said:
I think this is because the command button has the focus. Something has to
have the focus so if these are the only controls on the form then you might
need to resort to an old trick. Create a textbox with no label. Make this
control the first control in the tab order then set the size of the textbox
to .001 x .001. When the form opens your textbox will have the focus but
since it is too small to be visible you won't even know it's there.

--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.
I have a small form with 3 command buttons on it (each opens another
form). Each command button has "no" set for the Tab Stop property. The
button with the Tab Index of zero always has a faint dotted box around
the button text.

Is there a way to eliminate this dotted box so all the buttons look
"clean?"

Thanks.

Jerry
 
you're welcome, Jerry ;) happy to help

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access
strive4peace2006 at yahoo.com


Thanks Crystal and Sandra. Crystal's idea was the most fitting and worked
perfectly.

Jerry

:

I think this is because the command button has the focus. Something has to
have the focus so if these are the only controls on the form then you might
need to resort to an old trick. Create a textbox with no label. Make this
control the first control in the tab order then set the size of the textbox
to .001 x .001. When the form opens your textbox will have the focus but
since it is too small to be visible you won't even know it's there.

--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.
I have a small form with 3 command buttons on it (each opens another
form). Each command button has "no" set for the Tab Stop property. The
button with the Tab Index of zero always has a faint dotted box around
the button text.

Is there a way to eliminate this dotted box so all the buttons look
"clean?"

Thanks.

Jerry
 
Interesting - I didn't even know there was a default property for a command
button. You learn something new every day!
 
Hi Sandra,

The Default property makes it do the Onclick event when
ENTER is pressed ... instead of ENTER going to the next
field, which is what I prefer (for users).

Isn't this great! I love learning everyday! For years, I
(mostly) only knew what I taught myself by reading and
figuring out things for my students and now...

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access
strive4peace2006 at yahoo.com
 
Hi Jerry,

I wanted to mention something else you can do instead of
making your button a default... make use of ALT-keys...

&OK
will underline the O so the user can press ALT-O to activate
(I always try not to conflict with the menu bar as I leave
that up most of the time)

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access
strive4peace2006 at yahoo.com


Thanks Crystal and Sandra. Crystal's idea was the most fitting and worked
perfectly.

Jerry

:

I think this is because the command button has the focus. Something has to
have the focus so if these are the only controls on the form then you might
need to resort to an old trick. Create a textbox with no label. Make this
control the first control in the tab order then set the size of the textbox
to .001 x .001. When the form opens your textbox will have the focus but
since it is too small to be visible you won't even know it's there.

--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.
I have a small form with 3 command buttons on it (each opens another
form). Each command button has "no" set for the Tab Stop property. The
button with the Tab Index of zero always has a faint dotted box around
the button text.

Is there a way to eliminate this dotted box so all the buttons look
"clean?"

Thanks.

Jerry
 
ps

&OK would be the CAPTION property of the command button

for textboxes that have attached labels, you can put & in
the caption property of the label

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access
strive4peace2006 at yahoo.com


Hi Jerry,

I wanted to mention something else you can do instead of making your
button a default... make use of ALT-keys...

&OK
will underline the O so the user can press ALT-O to activate
(I always try not to conflict with the menu bar as I leave that up most
of the time)

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access
strive4peace2006 at yahoo.com


Thanks Crystal and Sandra. Crystal's idea was the most fitting and
worked perfectly.

Jerry

:

I think this is because the command button has the focus. Something
has to have the focus so if these are the only controls on the form
then you might need to resort to an old trick. Create a textbox with
no label. Make this control the first control in the tab order then
set the size of the textbox to .001 x .001. When the form opens your
textbox will have the focus but since it is too small to be visible
you won't even know it's there.

--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.

JWCrosby wrote:

I have a small form with 3 command buttons on it (each opens another
form). Each command button has "no" set for the Tab Stop property. The
button with the Tab Index of zero always has a faint dotted box around
the button text.

Is there a way to eliminate this dotted box so all the buttons look
"clean?"

Thanks.

Jerry
 
There is a little trick I discovered. You can disable the button control and then re-enable it using VBA. That causes MS Access to put focus to another control, which will in essence get rid of the dotted square.

1. On mouse down
Me.CommandButton.Enabled = False
Me.CommandButton.Enabled = True

2. On mouse up
Me.CommandButton.Enabled = False
Me.CommandButton.Enabled = True

Give that a try. It seems to work for me.
 
Back
Top