Saturday, June 16, 2007

Making an image behave like a button

Sometimes you want to make a button with a favorite (small) image and you don't have a bmp file or a ico and cannot make one. In this case add the image that you want to your form.

Set the following properties on the image,
size mode = stretch (if the image is too large)
special effect = raised
name = "Something meaningful"

Now setup the following code for the onclick event.

Private Sub fetch1_Click()

'Make an image behave like a button
fetch1.SpecialEffect = acEffectSunken

YOUR CODE HERE (ie docmd.openform )

fetch1.SpecialEffect = acEffectRaised

End Sub

Here is a sample of an image as button

1 comment:

grovelli said...

Nice tip Garry