Hi Elainie,
It sounds like you are selecting something from a combobox and if a
textbox called "CompletedDate" is empty then you want to notify the user
and have the user fill in the textbox with a date. Anyway, my example
will be based on this scenario. I will also use naming conventions for
the controls. A textbox name is usually preceded by txt
as in txtCompletedDate and combobxes are preceded by cbo
as in cboTest
In the AfterUpdate event of the combobox you can do something like this:
Private Sub cboTest_AfterUpdate()
If txtStatus = "Completed" And txtCompletedDate = "" Then
txtCompletedDate.SetFocus
MsgBox "Completed date must be filled in"
End If
End Sub
The combobox AfterUpdate event occurs after a user selects something
from the combobox. Note that I also removed the parentheses from
txtStatus = "Completed". This is the correct syntax. And I set the
focus on txtCompleted before the MsgBox. It doesn't matter if you
.SetFocus before or after. I just usually do it before the MsgBox.
Rich
*** Sent via Developersdex
http://www.developersdex.com ***