Selective visibility

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

Guest

Is it possible to programme a database so that certain fields are only
visible when a specific value is entered into another field. I am setting up
a risk and issue register, when a record is an issue I need the form to show
several additional fields which I want to be hidden if the record is
classified as a risk.

Thanks
 
Mike said:
Is it possible to programme a database so that certain fields are only
visible when a specific value is entered into another field. I am setting up
a risk and issue register, when a record is an issue I need the form to show
several additional fields which I want to be hidden if the record is
classified as a risk.

Thanks

Set the field(s) to hide visible properties to No

ON the field with the specific value to be entered set its after update
property to the following:

Forms![FormName]![FirstInvisibleField].Visible = True

Or

me![FirstInvisibleField].Visible = True

Continue to add the fields to show or hide as shown above.
 
Add a function along these lines to the form's module:

Private Function ShowControls()

Const SPECIFICVALUE = "Specific value goes here"
Dim blnShowControls As Boolean

' does first control contain specific value
' and is form not at a new record?
blnShowControls = (Me.txtFirst = SPECIFICVALUE And Not Me.NewRecord)

' hide/show other controls
Me.txtSecond.Visible = blnShowControls
Me.txtThird.Visible = blnShowControls
Me.txtFourth.Visible = blnShowControls

End Function

In the form's properties sheet set its On Current event property to:

=ShowControls()

and do the same as the After Update event property of the txtFirst control.

This will only work in single form view as in a continuous form a control's
property cannot be applied selectively to the current row; its all or nothing.

Ken Sheridan
Stafford, England
 
Add a function along these lines to the form's module:

Private Function ShowControls()

Const SPECIFICVALUE = "Specific value goes here"
Dim blnShowControls As Boolean

' does first control contain specific value
' and is form not at a new record?
blnShowControls = (Me.txtFirst = SPECIFICVALUE And Not Me.NewRecord)

' hide/show other controls
Me.txtSecond.Visible = blnShowControls
Me.txtThird.Visible = blnShowControls
Me.txtFourth.Visible = blnShowControls

End Function

In the form's properties sheet set its Current event set its On Current
event property to:

=ShowControls()

and do the same as the After Update event property of the txtFirst control.

This will only work in single form view as in a continuous form a control's
property cannot be applied selectively to the current row; its all or nothing.

Ken Sheridan
Stafford, England
 
Sorry about duplicated reply. I got an error message which siggested it
hadn't been sent first time.

Ken
 
Back
Top