janjee said:
Need help I am facing problem, I tried with do while but it does not
work, the curser skip after giving message, to next field. I want
that cursor should not move or skip until the required value or any
value is entered in the textbox.
For almost all purposes, I don't think this is a good idea, for two
reasons: (1) you can't enforce this requirement unless you can also
force the focus into the control in the first place, and (2) if you
frustrate the users by not letting them out of the field, they may close
the form or even blast their way out of the database without doing other
things they ought to do. It's usually better, in my opinion, to
validate all required entries in the form's BeforeUpdate event, and
force the user to correct them then. That allows the user to fill out
forms in any order they find most practical.
That said, you can do it the way you want by using the control's Exit
event to enforce your requirement. Here's a sample event procedure:
'----- start of code -----
Private Sub YourControl_Exit(Cancel As Integer)
If IsNull(Me!YourControl) Then
MsgBox"You must enter something here before proceeding."
Cancel = True
End If
End Sub
'----- end of code -----