programtically change an Embedded picture of a command button

T

TADropik

I'd like to prgramatically change the Embeded picture of a command button.

I don't want to use a linked picture because the application is portable and
I don't want to have to copy the image along with the .mdb

Anyone have sample code for this?
 
J

Jon Lewis

Have an invisible CommandButton of the same size with the required image
embedded, then use the PictureData property.
Me.cmd1.PictureData = Me.cmd2.PictureData should do it.

-Jon
 
F

fredg

I'd like to prgramatically change the Embeded picture of a command button.

I don't want to use a linked picture because the application is portable and
I don't want to have to copy the image along with the .mdb

Anyone have sample code for this?

Probably quicker to simply open the form in Design View and change the
button's Picture property manually as you do need to have the picture
somewhere on the computer to set it as the button's picture, and it
will be faster than writing the below code.
However ...

Code a module

DoCmd.Echo False
DoCmd.OpenForm "FormName", acDesign, , , acFormPropertySettings,
acHidden
Forms!FormName!cmdButtonName.Picture =
"C:\PathToFolder\PictureName.ico"
DoCmd.Close acForm, "FormName", acSaveYes
DoCmd.OpenForm "FormName"
DoCmd.Echo True
 

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