So I have a quick question, I think. Can someone explain to me the difference between these two, or better yet, tell me how to do what I am trying to do. I have a textbox on a form that populates today's date (IssueDate). I have another box that the user puts in the expiration date. On the AfterUpdate event I have some code that checks to see if the ExpirationDate is > 30 days, and if it is, alerts the user that it must be within 30 days. This is all great, however, the alert doesn't happen when the user picks the date, it happens once they click on another control on the form. I want it to happen right away. I have put this code on AfterUpdate, BeforeUpdate, Dirty, and Change, and none of those work. How do I get this to function correctly. Thanks for any help.
Here is my code:
Private Sub txtExpDate_AfterUpdate()
Dim daysDiff As Integer
daysDiff = DateDiff("d", Me.IssueDate, Me.ExpirationDate)
If daysDiff > 30 Then
MsgBox "Quality alerts cannot expire more than 30 days from date of issue."
Me.ExpirationDate.Value = ""
p.s. that line Me.ExpirationDate.SetFocus
bombs out too, what's up with that?
Thanks again for taking the time to help me out.