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

Conditional Formatting to Make Visible?

Status
Not open for further replies.

cstuart79

Technical User
Nov 2, 2009
171
US
Stupid question, but is conditional formatting limited to all color/font changes or can it be used on a control to make textbox visible/invisible?
 
i want to be able to toggle between a command button and a textbox based upon the value of a checkbox; therefore, changing command button or textbox to color of background will not allow the other to show through (trying to conserve real estate by having them occupy the same space). was hoping that i could set color of either the command button or textbox to "transparent" or "visible/invisible".....any clever ideas for how to accomplish this?
 

How about something like this?
Code:
Private Sub CheckboxName_Click()
    Me.TextboxName.Visible = Me.CheckboxName
    Me.TextboxName.Enabled = Me.CheckboxName
    Me.ButtonName.Visible = Not Me.CheckboxName
    Me.ButtonName.Enabled = Not Me.CheckboxName
End Sub

Randy
 
I assumed that cstuart79 is referring to a continuous form although he didn't state this. This is based on his initial question regarding "conditional formatting" and his later statement "trying to conserve real estate".

Code that changes the format of a control will change it for every instance of the control on the continuous form.

Duane
Hook'D on Access
MS Access MVP
 
i am referring to a continuous form....hence the dilemma
 

This is a challenging question.

I don't think that there really is such a thing "no solution".

So let's not give up. let's hope - and wait - for an interesting solution from one of the more experienced members in here.
 
In this case, as described, I am betting there is no solution.

If you really absolutely had to do this, then make the form unbound. Create each row and then you can control the different controls on each row. You would then have to fill the records through code, and hide/show unused rows. That is a lot of work to save some space.
 
Make both the text box and command button invisible and use vba in the forms "OnCurrent" event to set the visible/enabled properties based on the checkbox. It'll show the appropriate item when you click (or use a navigation control to go the next/prev) on a record you want to work with, but you'll see it change on every record.

Worked on a small demo for me, but its far from ideal.

Alternate: Set your command button code on the "OnClick" for the text box. Run an IF to verify the value of the checkbox. Make your text box default value the name of your command button.
 
BDCarillo. The OP is using a continuous form. Your solution is for a single form view, and will not work in continuous view as has been previously discussed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top