Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Colored command buttons 2

Status
Not open for further replies.

kbestle

Technical User
Joined
Mar 9, 2003
Messages
67
Location
US
I am creating colored command buttons by using the techique of putting a label behind a command button a making the command button transparent when it is clicked. However, I have added code to switch all command buttons back to non-transparent first and then make the selected button transparent. This is not working. The first button is clicked and goes transparent but when the second button is click the first does not change.

I have a procedure that has a line for each command button like
Forms!myForm!cmd1.Transparent=No
Forms!myForm!cmd2.Transparent=No

and so on.
When I click on a button this procedure is called first.

Any ideas

Kent
 
From what you are describing that you are doing I don't see a problem. It should work. So, apparently what you are describing is happening actually isn't. Post the subroutine in total that turns them all back to NO and then post the OnClick of the second button. Let's see what is actually there.

There are times that we just can't see the forest for the trees. It happens to all of us. Bob Scriver
 
Here is the code for each command button

DoCmd.ShowAllRecords
Me!Command151.Transparent = 2


Here is the procedure.

Public Sub Buttons()


Me!Command151.Transparent = 1
Me!Command150.Transparent = 1
Me!Command149.Transparent = 1
Me!Command148.Transparent = 1
Me!Command147.Transparent = 1
Me!Command146.Transparent = 1
Me!Command145.Transparent = 1
Me!Command144.Transparent = 1
Me!Command143.Transparent = 1

End Sub

Thanks
 
You should use True and False, not 1 and 2.
From what I see here, you always set Transparent to True.
Remember that False (or No or Off) have the value of 0
True (or Yes or On) have the "official" value of -1, but you can think of it as "other than 0".

Good luck

[pipe]
Daniel Vlas
Systems Consultant
 
You sub assignments should be changed to = False and the code behind the button should set the .transparent property to True. Then this will work. Bob Scriver
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top