Results 1 to 7 of 7
  1. #1
    Slurry Pumper is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2016
    Posts
    28

    Command Button Color Control

    Hi all,

    I am creating a Form that will control several queries that will sort various noun modifiers in a parts table. The form will have around 10 separate queries that are available to the user. To run each query, all you do is press a command button. In the command button "Property Sheet" under the "Format" tab, I noticed the presence of several categories that allow me to change the look of the command button once it has been pressed. I figured hey great, just what I want, but of course there is a catch. The command button only changes color during the actual time the command button is pressed. How do I get the command button to retain the pressed colors after the button is pressed?

    In other words, I have a list of command buttons a user can select in the form, I want them to select the buttons and have that button change color and stay that color so that the user can see that the button has been selected and thus there is no need to select again, unless of course they want to due to changing some criteria that is associated with that command button from other areas of the form.

    Of course I'm new at this, so if it is a long dragged out process with a macro that is longer than text message, I may just bag the entire color idea.

  2. #2
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Change the color in the OnClick event

  3. #3
    Slurry Pumper is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2016
    Posts
    28
    Quote Originally Posted by aytee111 View Post
    Change the color in the OnClick event
    Boy that sounds great, but at this time, I'm not too knowledgeable on this program. I have an embedded macro that opens and closes a query that I created, but in the list of additions for building the macro, I didn't see a button formatting selection opportunity or anything that would alert me to being a starting path to changing the button format.

    Something tells me this is going to be an involved process for me.

  4. #4
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Time to get your feet wet! Change the embedded macro to Event Procedure. What all does your macro do?

    - To run a query type: DoCmd.OpenQuery "myqryname"

    - To change the color of the button: Me!buttonname.BackColor=RGB(1,2,3)

    - To find out what numbers to use for the Red/Green/Blue (1,2,3 above): click on the 3 dots next to the property "Back Color", click on "More Colors", click on Custom - there you will find what numbers to use

  5. #5
    Slurry Pumper is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2016
    Posts
    28
    All Right I give it a try. The macro opens a query that creates a table containing items above a certain entered dollar value, then opens that newly created table and deletes out all of the items that do not fulfill description criteria.

    As an example, If I want to know about AC Motors in my table, and I set a value at $500: The query will do that and make a table with just AC Motors in that cost over $500.

  6. #6
    Slurry Pumper is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2016
    Posts
    28
    Hey cool it Freaking worked. Now all I have to do is get rid of all of those message boxes that pop up for the queries.

  7. #7
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    DoCmd.SetWarnings False
    ...query
    DoCmd.SetWarnings True

    Also, in Access Options>Client Settings>Confirm - set to no (in 2010, don't know about 2016)

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

Similar Threads

  1. Replies: 5
    Last Post: 10-13-2015, 02:53 PM
  2. Replies: 1
    Last Post: 02-27-2015, 10:01 AM
  3. Replies: 1
    Last Post: 09-12-2014, 06:09 AM
  4. Replies: 1
    Last Post: 07-27-2010, 02:27 PM
  5. Replies: 2
    Last Post: 03-10-2009, 05:14 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