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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Button Painter 7

Status
Not open for further replies.

cariobulog

Technical User
Oct 30, 2005
44
LY
Anyone could help me how i can make my command button background color changing everytime i click it.
 
yes

________________________________________________________
Zameer Abdulla
Help to find Missing people
My father was a realistic father; not a vending machine dispense everything I demanded for!!
 
its not working with me. here is my another option regarding my command button.

I want to put a label on my command button, for each click / color the label name will automatically change.

for example:

click1 = red = material (label name)
click2 = blue = equipment (label name)
etc.

thanks and i hope you continue to give assistance.

thanks for being helpful
 
its not working with me. here is my another option regarding my command button.

I want to put a label on my command button, for each click / color the label name will automatically change.

for example:

click1 = red = material (label name)
click2 = blue = equipment (label name)
etc.

thanks and i hope you continue to give assistance.

thanks for being helpful
 
Code:
Private Sub Label0_Click()
    Select Case Me.Label0.Caption
    Case Is = "Any Caption"
        Me.Label0.Caption = "material"
        Me.Label0.BackColor = vbRed
    Case Is = "material"
        Me.Label0.Caption = "equipment"
        Me.Label0.BackColor = vbBlue
    Case Is = "equipment"
        Me.Label0.Caption = "material"
        Me.Label0.BackColor = vbRed
    End Select
End Sub

________________________________________________________
Zameer Abdulla
Help to find Missing people
My father was a realistic father; not a vending machine dispense everything I demanded for!!
 
sorry but its not working with me this code.how i can link this to my existing command button.if i click my command button to any color no label name is appearing.

thanks

 
I have another question, how i can save the color of my command button:

for example, i click it in red color and i want to save it and not going back to the previous color.
 
You cannot save it.
You have to use the form_current event to set it every time, using the same code that you already have.
 
its not also working, my problem is like this, i have a command button which has changing in different colors everytime i click it. Each click/color there is assigned remarks. It goes like this;

gray - means "not completed"
red - means "completed"

what i want is if i click the command button and the color is red means "completed" and i want to save it and to be remain red . what happens is if i close the form and when i open it again the color of command button is going back to gray color.

many thanks
 
You will have to add a field to your table to record the status of your record, and update the status each time you click the button. You can then work out the correct colour of the button in the form_current event each time you move to that record.
 
What you should do is this:

Set the default value of your Status field to 0. Add the status to the form as a hidden control.
Then in your button click event you do:

me.status = me.status+1
SetColours ' this is a separate procedure.

Then you need the procedure. I don't really know what the code is for this as you don't seem to any working code yet, but it will be something like:

Sub SetColours()
Select case me.status
Case 0
Me.Label0.Caption = "material"
Me.Label0.BackColor = vbRed
Case 1
Me.Label0.Caption = "equipment"
Me.Label0.BackColor = vbBlue
Case 2
Me.Label0.Caption = "material"
Me.Label0.BackColor = vbRed
case else
' something else here
End Select

End sub

You can then call SetColours in the Form_Current event as well so that the labe gets set to the colours each time you move to a new record.

 
sorry lupin, this is complicated with me i could not do it.Here is my current code in the form. What i want is, when i click the command button into red i want to save it so that it will not go back to gray color everytime im opening the form.
What happens is if i click the command button into red and then save it and close the form, when im going to open the form again the color of command button is going back to gray color.
Please note that i did not create yet any table.

Thanks for your patience.


Private Sub CommandButton5_Click()
If Me.CommandButton5.BackColor = vbGrayThen
Me.CommandButton5.BackColor = vbRed
Else
Me.CommandButton5.BackColor = vbGray
End If
End Sub
 
sorry lupin, this is complicated with me i could not do it.Here is my current code in the form. What i want is, when i click the command button into red i want to save it so that it will not go back to gray color everytime im opening the form.
What happens is if i click the command button into red and then save it and close the form, when im going to open the form again the color of command button is going back to gray color.
Please note that i did not create yet any table.

Thanks for your patience.


Private Sub CommandButton5_Click()
If Me.CommandButton5.BackColor = vbGrayThen
Me.CommandButton5.BackColor = vbRed
Else
Me.CommandButton5.BackColor = vbGray
End If
End Sub
 
It is little complicated for a beginner...

You have to either record the settings in the Registry
(Look for "SaveSettings", "GetSetting", "GetAllSettings" in the VBA help file.)

Or
you have to save the settings into a table using a Yes/No field. Then use "DlookUp" to get the setting.

________________________________________________________
Zameer Abdulla
Help to find Missing people
My father was a realistic father; not a vending machine dispense everything I demanded for!!
 
thanks, your right mr. zameer it is complicated now, what would be the easiest way? maybe i could use the conditional fomatting. Or there is possibility that you convert the text box to a command button?

thanks for your time
 
Can you expalin us what are you exactly trying to do?

We started from somewhere and reached somewhere...

Keep in mind..
Continues forms have drawbacks on setting style on each row. Unless it is bound and conditional formatting.


________________________________________________________
Zameer Abdulla
Help to find Missing people
My father was a realistic father; not a vending machine dispense everything I demanded for!!
 
sorry for wasting your time..,

Im trying to make a form just like a switchboard that summarize our material list.

In my form i have 8 material names, for example;

material1
material2
and so on up to
material8

each row of material name i have check box and command button, for example

Material Name Available Ship. Clearance Ship. Arrived
material1 Checkbox Command Button Command Button

Each command button i want to assign a color coding for each click, for example
in Ship. Clearance i want to color code the each click
click1 - red - "cleared"
click2 - blue - "not cleared"
click3 - yellow - "pending in customs"

thanks for your patience.


 
Many questions..
1) Does the form have a recordsource (a query or a table)?
2) Is this form using for printing?
3) How do you know the availability update of materials?
4) Is this a continues form?
5).......

________________________________________________________
Zameer Abdulla
Help to find Missing people
My father was a realistic father; not a vending machine dispense everything I demanded for!!
 
question1 - now i created now a table for each material, for ex.
Table_Material1 - material name, available,ship. clearance etc.
Table_Material2 - - material name, available,ship. clearance etc.
and so on...

The i create a form like this;

Material Name Available Ship. Clearance Ship. Arrived
material1 Checkbox Command Button Command Button

question2-yes

question3-sorry i dont know wat u mean. what i understood is by appearing the check in the box it means available.

question4-single form

in addition;

i want also the color of the command button every time i click to another color will be save so that will not comeback to a previous color.

thanks for your help





 
You are missing some basic understanding of dbs....

You said it is a single form and you have 8 rows in it!
It is not matching with normal design.

Are you sure you won't be having more than 8 items in the future?

Are you sure you don't need to keep the history of the transactions?

Read more about fundamentals of relational dbs here.

Regards




________________________________________________________
Zameer Abdulla
Help to find Missing people
My father was a realistic father; not a vending machine dispense everything I demanded for!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top