How stop routine if text field is left blank
Posted on 2012-04-13
I have a form which contains a command button. Also on this form is a text field. When the command button is clicked and if the text field is left blank I want the routine to stop and make the user enter a value in the text field. Here is my attempt...
If Me.txtPOn = "" Then
MsgBox "You must enter a PO number first!"
But what is happening is the record is getting written to the table because of code after the above code. This is not what I want to have happen. Instead, the whole routine should halt and the focus should be on the text box.. "txtPOn".
I can't figure out how to make this happen. Can someone help?