K
Kurt Heisler
What is the best to way to exclude a specific control (or controls)
from the following condition? (e.g., I would like to exclude SubjectID
and MRN from being Enabled or Disabled):
###
Dim Ctl As Control
On Error Resume Next
If IsNull(Me.SubjectID) OR IsNull(Me.MRN) Then
For Each Ctl In Me.Controls
Ctl.Enabled = False
Next Ctl
Else
For Each Ctl In Me.Controls
Ctl.Enabled = True
Next Ctl
End If
###
I'm using this to ensure that the user enters the SubjectID and MRN
*before* entering more data for the subject. By disabling all the
controls when SubjectID and MRN are blank, he has no choice but to
start there.
(I realize I can evaluate later whether SubjectID & MRN are null, like
when the user tries to leave the record, but I'd prefer to do it ahead
of time.) I need the code to work in the form's OnCurrent Event
(basically, for new records), and also in the OnClick event of a
button that says "Go!" (which will enable the controls).
If there is a more reliable/efficient way to go about enforcing this
kind of quality control, I'm all ears.
from the following condition? (e.g., I would like to exclude SubjectID
and MRN from being Enabled or Disabled):
###
Dim Ctl As Control
On Error Resume Next
If IsNull(Me.SubjectID) OR IsNull(Me.MRN) Then
For Each Ctl In Me.Controls
Ctl.Enabled = False
Next Ctl
Else
For Each Ctl In Me.Controls
Ctl.Enabled = True
Next Ctl
End If
###
I'm using this to ensure that the user enters the SubjectID and MRN
*before* entering more data for the subject. By disabling all the
controls when SubjectID and MRN are blank, he has no choice but to
start there.
(I realize I can evaluate later whether SubjectID & MRN are null, like
when the user tries to leave the record, but I'd prefer to do it ahead
of time.) I need the code to work in the form's OnCurrent Event
(basically, for new records), and also in the OnClick event of a
button that says "Go!" (which will enable the controls).
If there is a more reliable/efficient way to go about enforcing this
kind of quality control, I'm all ears.