Full Version: Make a Control Hidden
UtterAccess Forums > Microsoft® Access > Access Forms
mike60smart
Hi Everyone
I have a Form called frmCallBacks
I would like to make controls hidden based on the values in 2 other Controls
If Me.Patient = ME.ReferredBy Then
Me.ReferredBy.Visible = False
Me.RefType.Visible = False
End If
Is this code near to waht I need and would I place this code in the OnCurrent event of the Form?
Is there any other code I need to make this achievable?
Regards
Mike
Steve Schapel
Mike,
You will need to provide for the opposite as well. Like this:
If Me.Patient = Me.ReferredBy Then
Me.ReferredBy.Visible = False
Me.RefType.Visible = False
Else
Me.ReferredBy.Visible = True
Me.RefType.Visible = True
End If
Alternatively:
Me.ReferredBy.Visible = Me.Patient <> Me.ReferredBy
Me.RefType.Visible = Me.Patient <> Me.ReferredBy
However, I note that one of the controls which will be hidden (ReferredBy) is the control that determines the condition. That means you won't be able to change it, so make sure this won't cause a problem.
mike60smart
Hi Steve
Tried both of those examples
Oplaced the code in the OnCurrent of the Form
None of the Controls are hidden
What am I doing wrong?
Mike
Steve Schapel
Mike,
That are the 'Patient' and 'ReferredBy' controls? If they are comboboxes, ensure that the Bound Column is the same for both. Otherwise, I can't think what the problem might be. If the data in the Patient and ReferredBy controls is identical, then the ReferredBy and RefType controls should not be visible when you move to an existing record.
mike60smart
Hi Steve
Not it to work fine many thanks I had a spelling mistake
Cheers
Mike o! o! thanks.gif uarulez2.gif
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.