Results 1 to 8 of 8
  1. #1
    miziri is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Aug 2009
    Posts
    80

    Command buttom on click


    Hi,
    Friend I have many command buttons for example one I call command1 I want first click on that button fore color (font color) change into red and when i click again cancel color of font became again black.first part of question second part when i close form and open it save my color,I mean when button one is red color I close and open form it must red as it was select by click.


    I hope I clear .
    Thanks for Iraq

  2. #2
    miziri is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Aug 2009
    Posts
    80
    Hi,
    I my question is very difficult or if it not clear i can make more clear

  3. #3
    dcrake's Avatar
    dcrake is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Aug 2009
    Posts
    435
    I thnk I know what you mean.
    If you first create a public variable in a standard module

    Public BtnColor as long

    Then when you click on the button it sets the value of this variable to what you want it to be.
    So for example lets say the button by default is black, when you first open the application you set this accordingly

    BtnColor = vbBlack

    When you form opens the on load event fires the following code

    Me.Command1.FontColor = btnColor

    Now if you click on the button you first need to see what color it is now

    If Me.Command1.FontColor = vbBlack Then
    btnColor = vbRed
    End If

    Me.Command1.FontColor = btnColor

    So lets say you clicked it once and it changed it to red. You then close the form and re open it. Now the color will still be red as it is responding to the btnColor setting.

    Hope you understand me.

    David

  4. #4
    miziri is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Aug 2009
    Posts
    80
    Hi dcrake,\
    Let try my basic infomation with your advise

    thx

  5. #5
    miziri is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Aug 2009
    Posts
    80

    Friend I send my file can do it

    Hi,
    I have try a lot i fail to do it see attached file
    can make and send back to me

    thx

  6. #6
    Yance is offline Novice
    Windows XP Access 2003
    Join Date
    Aug 2009
    Posts
    22
    Hello Miziri,
    I've seen your project example. Your code writing method is wrong. I suggest you read the access help for the writing code method.

    Here i have enclosed your project example that i've modified to change the command button fore color and keep the color when the form is close/save.
    This trick is very simple. Hope this can solve your problem.

    Yance Lawang

  7. #7
    miziri is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Aug 2009
    Posts
    80

    Thanks that what I am look for

    Hi,\ Friend many thanks for your offering help. in my country is not easy to get book or easily internet to search for help thanks from iraq

  8. #8
    Yance is offline Novice
    Windows XP Access 2003
    Join Date
    Aug 2009
    Posts
    22
    Indonesia glad can help you.

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

Similar Threads

  1. On Click - Ignore Required Fields
    By amy in forum Forms
    Replies: 1
    Last Post: 08-18-2009, 07:42 AM
  2. Replies: 2
    Last Post: 04-29-2009, 11:37 AM
  3. On-Click event transfer
    By nkenney in forum Forms
    Replies: 16
    Last Post: 03-26-2009, 09:02 PM
  4. On click menu items do not work
    By mrk68 in forum Access
    Replies: 1
    Last Post: 03-23-2009, 07:29 PM
  5. Mouse click to open form
    By darryl.charles in forum Programming
    Replies: 0
    Last Post: 09-05-2008, 10:33 AM

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