I have a form that requires an unbound field not to be null, but the data it contains doesn't have to be there in the first place, ie. I can't just make the data a required field in its table.
So I wrote a little bit of VBA to do it ...
Private Sub newlabel_LostFocus()
If IsNull([newlabel]) Then
This works OK, in that the message pops up under the right conditions (eg. if the user deletes existing content, or leaves a blank entry blank), but the focus moves on to the next field for some reason. I can correct this by adding a SendKeys backtab, but I don't like to use SendKeys and can't see what's wrong with the code.