Check For Status of Record

  • Thread starter charles bosen via AccessMonster.com
  • Start date
C

charles bosen via AccessMonster.com

I have a status drop-down on my form. I need to send an email to a person
when the status is changed to closed. My code is not working.

Can anyone help me with this?? Here's my code:

Private Sub Status_AfterUpdate()
Me.Status = Status

If Me.Status = closed Then
' If closed, Notify person reported'
MsgBox "Person Reported this Issue Is Notified"
DoCmd.SendObject acSendNoObject, , , Me.Reportedby, , , "Discrepancy Issue
Tracking No: " & Me.TrackingNo & "", "THIS ISSUE HAS BEEN CLOSED. -
Closed Date: " & Date & """"

Else
Exit Sub
End If
End Sub
 
G

Guest

you start the sub by asyning a value of status to me.status, so how can you
check in second line if me.status = closed, the code just changed it value to
status.
So it probably never pass the if condition, and it never send the mail.
 
C

Charles bosen via AccessMonster.com

Hi Ofer

The "Status" field is a drop-down that lists (open, closed, in progress).
What I'm trying to check for is if the status=closed then send the email.
Only if the status is closed will the email fire off. Otherwise exit the
sub.

Thanks,
CB
 
G

Guest

Try removing the first line, try this code
Private Sub Status_AfterUpdate()
' Me.Status = Status - I dont know what status eaual to.

If Me.Status = closed Then
' If closed, Notify person reported'
MsgBox "Person Reported this Issue Is Notified"
DoCmd.SendObject acSendNoObject, , , Me.Reportedby, , , "Discrepancy Issue
Tracking No: " & Me.TrackingNo, "THIS ISSUE HAS BEEN CLOSED. -
Closed Date: " & Date
Else
Exit Sub
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top