How can I prevent a form from closing if the "ProjEnd" date field < "ProjStart" date field. I need to prompt user that they cannot close if the "ProjEnd" date < "ProjStart" date. I do not have a close button. I use the File, Close in the menu. Thanks -- deb
Use the forms Unload event; Private Sub Form_Unload(Cancel As Integer) If Me![ProjEnd] < Me![ProjStart] Then MsgBox "The end cannot come before the beginning" Cancel = True Me![ProjEnd].SetFocus End If End Sub -- _________ Sean Bailey "deb" wrote: > > How can I prevent a form from closing if the "ProjEnd" date field < > "ProjStart" date field. I need to prompt user that they cannot close if the > "ProjEnd" date < "ProjStart" date. > > I do not have a close button. I use the File, Close in the menu. > > Thanks > > -- > deb