Bring to Front/Send to Back

P

PeterM

I have a form in AC2003 that has several command buttons. I have used an
image control to place the image control on top of the button. For example.
The btnHelp is a command button with a caption of " Help". I put the
spaces in front of the text to make room for the small image. I put the
image on top of the command button. I click on the command button and FORMAT
--> SEND TO BACK. I next click on the image (that's sitting on top of the
left portion of the command button) and FORMAT --> BRING TO FRONT.

When I run the form, the button looks fine once the form opens. The image
is on the left side of the command button and the text " Help" is the
caption for the button.

When I click on the command button, the image disappears. Thru some
testing, if I setfocus to any control on the form other than the command
button, the image reappears.

Here is the code for the click event of the command button:

DoCmd.OpenForm "Help", acNormal, , , acFormReadOnly, acDialog, "Addresses"
Me.FirstName.SetFocus

When I close the Help form, the Me.FirstName.SetFocus fires, the image
reappears.

My question is, is there a way to force the image to always remain on top of
the command button?

Thanks as always!
 
D

Daryl S

PeterM -

Have you tried creating a custom bitmat that has both the picture and the
text, then making that the Picture property of the button?
 
J

John Spencer

No, when the button control gets the focus it automatically comes to the fore
until it loses the focus.

Of Course, you could just put the code in the image control's events instead
of in the button's events. Then you might not need to set focus to the button
or even have the button.

OR you could set the focus elsewhere BEFORE you open the form in dialog mode
Me.FirstName.SetFocus
DoCmd.OpenForm "Help", acNormal, , , acFormReadOnly, acDialog, "Addresses"

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
 
D

De Jager

PeterM said:
I have a form in AC2003 that has several command buttons. I have used an
image control to place the image control on top of the button. For
example.
The btnHelp is a command button with a caption of " Help". I put the
spaces in front of the text to make room for the small image. I put the
image on top of the command button. I click on the command button and
FORMAT
--> SEND TO BACK. I next click on the image (that's sitting on top of the
left portion of the command button) and FORMAT --> BRING TO FRONT.

When I run the form, the button looks fine once the form opens. The image
is on the left side of the command button and the text " Help" is the
caption for the button.

When I click on the command button, the image disappears. Thru some
testing, if I setfocus to any control on the form other than the command
button, the image reappears.

Here is the code for the click event of the command button:

DoCmd.OpenForm "Help", acNormal, , , acFormReadOnly, acDialog, "Addresses"
Me.FirstName.SetFocus

When I close the Help form, the Me.FirstName.SetFocus fires, the image
reappears.

My question is, is there a way to force the image to always remain on top
of
the command button?

Thanks as always!
 

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