If Closed Date exists, then Status is Closed. Else Status is open

  • Thread starter Thread starter Sierras
  • Start date Start date
S

Sierras

Hi

I'm tried to get a field in a subform to automatically show if the status
of record is open or closed based on the closed date. I have something
like this, but it doesn't work:

Private Sub Status_AfterUpdate()
If Not IsNull(Me.[Closed]) Then
Me!Status = "Open"
Else
Me!Status = "Closed"
End If
End Sub

Any ideas what I'm doing wrong?
 
OK - I removed the Status field and replaced it with a calculated field
and wrote this in the control source:

=IIf([Closed]>0,"Closed","Open")

This works fine, but now how do I apply a filter to this form to filter on
the new calculated field which is called Text40? And do I guess I'm going
to have to create a calculated field in every report and form that used to
use the Status field as well.

Thanks
 
I fixed it by replacing the Text40 field back to the Status field and
then just changed the underlying query to

Status:=IIf([Closed]>0,"Closed","Open")

This now allows same as before and also updates with the record closed
date. Also I deleted the Status field from the table since it doesn't
need one anymore.

Thanks for all your help...



OK - I removed the Status field and replaced it with a calculated field
and wrote this in the control source:

=IIf([Closed]>0,"Closed","Open")

This works fine, but now how do I apply a filter to this form to filter on
the new calculated field which is called Text40? And do I guess I'm going
to have to create a calculated field in every report and form that used to
use the Status field as well.

Thanks

Hi

I'm tried to get a field in a subform to automatically show if the
status of record is open or closed based on the closed date. I have
something like this, but it doesn't work:

Private Sub Status_AfterUpdate()
If Not IsNull(Me.[Closed]) Then
Me!Status = "Open"
Else
Me!Status = "Closed"
End If
End Sub

Any ideas what I'm doing wrong?
 
Back
Top