BaldyWeb

How Can I Make a Control Visible Based on the Value of Another?

Sometimes you want to control the visibility (or other property) of one control to be based on the value in another.  This is the type of code you would use:
 
Code:
  
    If Me.ControlName = "Whatever" Then
        Me.OtherControlName.Visible = True
    Else
        Me.OtherControlName.Visible = False
    End If

Depending on your situation, you might also want to clear the contents of the second control if you're making it invisible.  You would put that code in the After Update event of the control you're testing, so that when you changed the value it would execute the code.  You might also want the code in the Current event, which would fire when you change records.
 

Home