Hi
I have a form which has a subform. The sub form shows all other items in a batch related to the record being displayed on the main form as a continous form.
What I want to do is that if a field IsNull, for the appropriate record on the subform to display red and if the field has a value for the record to show green. However the code I have created below makes all the records on the subform go green or red, not any of the individual records on the subform.
Could someone have a look and let me know any solutions
Private Sub Form_Current()
If IsNull(DLookup("[Result]", "[Sample Details]", "[Our Sample Number]=" & Forms![Sample Results]![Our Sample Number])) Then
Me.Our_Sample_Number.BackColor = 255
Me.Clients_Sample_Number.BackColor = 255
Else
Me.Our_Sample_Number.BackColor = 65280
Me.Clients_Sample_Number.BackColor = 65280
End If
Exit_handler:
Exit Sub
Err_handler:
MsgBox Err.description
Resume Exit_handler
End Sub
Many Thanks
Richard
I have a form which has a subform. The sub form shows all other items in a batch related to the record being displayed on the main form as a continous form.
What I want to do is that if a field IsNull, for the appropriate record on the subform to display red and if the field has a value for the record to show green. However the code I have created below makes all the records on the subform go green or red, not any of the individual records on the subform.
Could someone have a look and let me know any solutions
Private Sub Form_Current()
If IsNull(DLookup("[Result]", "[Sample Details]", "[Our Sample Number]=" & Forms![Sample Results]![Our Sample Number])) Then
Me.Our_Sample_Number.BackColor = 255
Me.Clients_Sample_Number.BackColor = 255
Else
Me.Our_Sample_Number.BackColor = 65280
Me.Clients_Sample_Number.BackColor = 65280
End If
Exit_handler:
Exit Sub
Err_handler:
MsgBox Err.description
Resume Exit_handler
End Sub
Many Thanks
Richard