J
Joel Wiseheart
I use the following code, that initializes all of the
data entry controls on a form as disabled. Then, a person
searches for a "MRR Number". Not all MRR's require
rework, so sometimes the resulting search returns no
records. I only want to enable the controls if the form's
recordset contains records after the requery.
The code below is what I have. I was wondering if I'm
missing a way to do this in less than twenty-something
lines. I thought about using a For Each - Next loop, but
not all of the controls need to be disabled, only the 8
for data entry (There's some other controls that provide
reference data). Is there a shorter way to do this?
With Me
!ReworkedBy.Enabled = False
!ReworkDate.Enabled = False
!btnReworkDate.Enabled = False
!ReworkLabor.Enabled = False
!InspectedBy.Enabled = False
!InspectionDate.Enabled = False
!btnInspectionDate = False
!InspectionLabor.Enabled = False
End With
If rst.RecordCount > 0 Then
With Me
!ReworkedBy.Enabled = True
!ReworkDate.Enabled = True
!btnReworkDate.Enabled = True
!ReworkLabor.Enabled = True
!InspectedBy.Enabled = True
!InspectionDate.Enabled = True
!btnInspectionDate = True
!InspectionLabor.Enabled = True
!ReworkedBy.SetFocus
End With
Else
If Me.Parent!txtMRR = "" Then
Exit Sub
Else
MsgBox "This MRR has no dispositions.",
vbExclamation, "No MRR Dispositions"
Me.Parent!txtMRR.SetFocus
End If
End If
Thanks!
Joel
data entry controls on a form as disabled. Then, a person
searches for a "MRR Number". Not all MRR's require
rework, so sometimes the resulting search returns no
records. I only want to enable the controls if the form's
recordset contains records after the requery.
The code below is what I have. I was wondering if I'm
missing a way to do this in less than twenty-something
lines. I thought about using a For Each - Next loop, but
not all of the controls need to be disabled, only the 8
for data entry (There's some other controls that provide
reference data). Is there a shorter way to do this?
With Me
!ReworkedBy.Enabled = False
!ReworkDate.Enabled = False
!btnReworkDate.Enabled = False
!ReworkLabor.Enabled = False
!InspectedBy.Enabled = False
!InspectionDate.Enabled = False
!btnInspectionDate = False
!InspectionLabor.Enabled = False
End With
If rst.RecordCount > 0 Then
With Me
!ReworkedBy.Enabled = True
!ReworkDate.Enabled = True
!btnReworkDate.Enabled = True
!ReworkLabor.Enabled = True
!InspectedBy.Enabled = True
!InspectionDate.Enabled = True
!btnInspectionDate = True
!InspectionLabor.Enabled = True
!ReworkedBy.SetFocus
End With
Else
If Me.Parent!txtMRR = "" Then
Exit Sub
Else
MsgBox "This MRR has no dispositions.",
vbExclamation, "No MRR Dispositions"
Me.Parent!txtMRR.SetFocus
End If
End If
Thanks!
Joel