I'm creating a database to track immunizations. I have a main form with names and other pertinent info, and I have a subform with the immunizations listed. The subform shows the following and is a continuous form:
ImmunizationName DateCompleted DateNextDue
I want to change the text color of the DateNextDue field based on todays date and if the immunization is overdue. I used the following code placed in the Form_Current event of the subform:
Private Sub Form_Current()
If txtImmunizationNextDue < Now() Then
txtImmunizationNextDue.ForeColor = vbRed
Else
txtImmunizationNextDue.ForeColor = vbBlack
End If
End Sub
This has the following effect; if a record in the subform is selected with an overdue shot ALL of the NextDue fields in the subform change to red. Is there a way to reference the txtImmunizationNextDue control for only one record in a continuous subform and change it's text to red and leave the others as black?
ImmunizationName DateCompleted DateNextDue
I want to change the text color of the DateNextDue field based on todays date and if the immunization is overdue. I used the following code placed in the Form_Current event of the subform:
Private Sub Form_Current()
If txtImmunizationNextDue < Now() Then
txtImmunizationNextDue.ForeColor = vbRed
Else
txtImmunizationNextDue.ForeColor = vbBlack
End If
End Sub
This has the following effect; if a record in the subform is selected with an overdue shot ALL of the NextDue fields in the subform change to red. Is there a way to reference the txtImmunizationNextDue control for only one record in a continuous subform and change it's text to red and leave the others as black?