Results 1 to 10 of 10
  1. #1
    kdbailey is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Aug 2012
    Posts
    228

    Changing Picture on Command Button

    I'm looking to change the picture on my command button between access default pictures. First "Filter", second "Filter by Form".



    For the life of me I cannot figure out how to change the Picture property, as it is set to "(Image)" no matter what I choose, and I cannot find another property in which it directs to an embedded file somewhere.

    Anybody know how to switch back and forth? I'd really prefer not to have to make 2 buttons.

  2. #2
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,474
    So you have a button that as an image(instead of text) and you want to change the picture to another picture when they click on it?

  3. #3
    kdbailey is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Aug 2012
    Posts
    228
    In a nutshell, yes.

    The images are embedded in Access already, not external pictures.

  4. #4
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,474
    Do you have to use pictures, why not just use words and change them as needed by the .caption property?

    If me.control1.caption = "Filter" then
    me.control1.caption = "Filter By Form"
    Else
    me.control1.caption = "Filter"
    End If

    Or you could use 2 buttons, one on top of the otther. When they click the first one, do the process then make it invisible and the other button visible. Put same code in for 2nd button as well.

    There are picture properties on a control when you do it in code Me.Piccontrol1.Picture

  5. #5
    kdbailey is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Aug 2012
    Posts
    228
    Caption is not viable and I'm trying to avoid two versions of the same command buttons. There are 11 of these buttons currently.

    As for the .Picture property, it's value is consistently "(Image)" if you select one of the embedded access pictures.

    If I need to, I'll create the second buttons, but would prefer not to.

  6. #6
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,474
    Do you have to an image instead of text?

  7. #7
    Micron is online now Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Don't know how to get at or alter this property, but my suggestion would be to have 2 image controls laid over the button. Show one and hide the other according to the need.

  8. #8
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,474
    If you can save the bmp images for those 2 actions to a folder on network on local PC, try this code on the button.

    Me.YourButton.Picture = "C:\AA\aa.bmp"

    So to switch them maybe:
    If Me.YourButton.Picture = "C:\AA\Filter.bmp" then
    Me.YourButton.Picture = "C:\AA\FilterByForm.bmp"
    Else
    Me.YourButton.Picture = "C:\AA\Filter.bmp"
    End If

  9. #9
    Micron is online now Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    found a sample db for retrieving table stored pics here in post #8; haven't had time to look at it much.
    Apparently, it doesn't require a lot of table overhead and seems to provide a way to store your chosen pics. Mostly I don't advocate storing images in tables, but this db is only about 300k with a few forms and a table with 2 images, so that seems OK.

  10. #10
    Shadow9449 is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Feb 2017
    Posts
    38
    If I may make a suggestion:

    - put 2 buttons on the form and hide them. Let's call them cmdFilter and cmdFilterbyForm
    - Set the picture on each to the Access button picture you want.
    - When you want your command button to show the picture of one or the other just use:
    Me.CommandButton.PictureData = Me.cmdFilter.PictureData or Me.CommandButton.PictureData = Me.cmdFilterbyForm.PictureData

    That will dynamically change the picture to the one you want. I hope I understood the question correctly!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 01-13-2013, 02:40 AM
  2. Changing Action on a Command Button
    By ETCallHome in forum Forms
    Replies: 5
    Last Post: 03-14-2011, 05:53 AM
  3. Replies: 6
    Last Post: 12-27-2010, 10:26 PM
  4. Replies: 11
    Last Post: 10-01-2010, 11:12 PM
  5. Changing Field Values with Command Button
    By avarusbrightfyre in forum Access
    Replies: 1
    Last Post: 08-22-2010, 12:48 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums