Enabling/disabling control upon display of record

  • Thread starter Thread starter Chaplain Doug
  • Start date Start date
C

Chaplain Doug

I am displaying records on a continuous form. Each record
has three visible fields and a hidden field. I wish to
enable or disable the three fields based on the value of
the hidden field as the records are displayed.

For instance, in my continuous form I have the fields:

Completed (a check box), Grade (a text box), and Date (a
text box)

Based on the value of the hidden (nonvisible) field [Type]
(which can be Check or Grade) I want to diable either the
Check box control or the Grade control. Any suggestions?
By the way, conditional formatting is not available for
check boxes is it?
 
You could use code in the form's OnCurrent event similar to this:

Private Sub Form_Current()
Me.Completed.Enabled = (Me.Type.Value = "SomeValue")
Me.Grade.Enabled = Not (Me.Type.Value = "SomeValue")
End Sub

Conditional formatting is not available for a checkbox.
 
Is the OnCurrent event triggered each time the form paints
a record in "continuous form" mode? Or is it just
triggered when the user moves from record to record in the
form?
-----Original Message-----
You could use code in the form's OnCurrent event similar to this:

Private Sub Form_Current()
Me.Completed.Enabled = (Me.Type.Value = "SomeValue")
Me.Grade.Enabled = Not (Me.Type.Value = "SomeValue")
End Sub

Conditional formatting is not available for a checkbox.
--
Ken Snell
<MS ACCESS MVP>


I am displaying records on a continuous form. Each record
has three visible fields and a hidden field. I wish to
enable or disable the three fields based on the value of
the hidden field as the records are displayed.

For instance, in my continuous form I have the fields:

Completed (a check box), Grade (a text box), and Date (a
text box)

Based on the value of the hidden (nonvisible) field [Type]
(which can be Check or Grade) I want to diable either the
Check box control or the Grade control. Any suggestions?
By the way, conditional formatting is not available for
check boxes is it?


.
 
It occurs when the user moves from one record to another. It also occurs
when the form is first "loaded".

There is no way to disable a control on one record and have that same
control be enabled on another record when you're using continous forms view.
The code that I provided will enable/disable controls for the "active"
record, which will prevent the user from making the wrong changes. But,
you'll see that each record has the same appearance (control
enabled/disabled) as the record on which the user is at that time.

--
Ken Snell
<MS ACCESS MVP>

Is the OnCurrent event triggered each time the form paints
a record in "continuous form" mode? Or is it just
triggered when the user moves from record to record in the
form?
-----Original Message-----
You could use code in the form's OnCurrent event similar to this:

Private Sub Form_Current()
Me.Completed.Enabled = (Me.Type.Value = "SomeValue")
Me.Grade.Enabled = Not (Me.Type.Value = "SomeValue")
End Sub

Conditional formatting is not available for a checkbox.
--
Ken Snell
<MS ACCESS MVP>


I am displaying records on a continuous form. Each record
has three visible fields and a hidden field. I wish to
enable or disable the three fields based on the value of
the hidden field as the records are displayed.

For instance, in my continuous form I have the fields:

Completed (a check box), Grade (a text box), and Date (a
text box)

Based on the value of the hidden (nonvisible) field [Type]
(which can be Check or Grade) I want to diable either the
Check box control or the Grade control. Any suggestions?
By the way, conditional formatting is not available for
check boxes is it?


.
 
Back
Top