Invisible Button

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to make a button or a text field on a form visible or
invisible depending on the contents of another text field on the form?
 
David,

It depends on whether this form is in Single view or Continuous view.
If it's in Single view, you can use VBA procedures on the form's Current
event, and the After Update event of the "another text field", to toggle
the Visible property of the other controls. Something like this...
Me.MyTextbox.Visible = Me.AnotherField = "fred"

However, if it's a Continuous form, this is not so easy, as this sort of
code will apply to all records. However, you can use Conditional
Formatting applied to the textbox so the ForeColor and BackColor are
both set to the same as the BackColor of the form... not really
Invisible, but you can't see it :-) This cannot be done with Command
Buttons.
 
Steve,
My form was in single view and your answer was so easy!
I looked all through my books and couldn't find any discussion of the topic.
Thanks!
David
 
I'm trying to create something similar on my form. I have a yes/no field
called spleenremove from my table called patient which is on my form as a
checkbox. I want my form to show a text field called spleenwt when the
spleenremove checkbox has been checked. I tried inserting
patient.spleenwt.Visible = patient.spleenremove = "yes" in the AfterUpdate
event of spleenremove and the Current event of my form. When I test it out,
I get an error message saying that it can't find the macro "patient". What
did I mess up?

Am I supposed to put the spleenwt field on the form or leave it off all
together?

What will happen if someone returns to that record in the form? If the
spleenremove is checked, will the spleenwt field always appear? What happens
if someone today enters a record, checks spleenremove, fills in spleenwt and
then returns the following day and unchecks spleenremove?

Thanks!
Sharon
 
Back
Top