How to ensure unbound text box does not remain null

  • Thread starter Thread starter Pete
  • Start date Start date
P

Pete

How can you ensure an Unbound text box in a Form has some data written into
it before it is closed i.e. an entry is required? Some enlightenment would be
much appreciated.
 
Hi Pete,

If it's an unbound textbox, it's up to you (as the programmer) to decide how
to treat any entry in that box. You can't use the BeforeUpdate event of the
form itself (the normal way of doing any validation not already enforced by
rules on the underlying table) since that only applies to bound fields. And
further, if the control is not bound to any underlying field, what would be
the point - any data entered is not going to be saved.

Your question seems rather pointless - perhaps you could elaborate further
and someone may be able to help more.

Rob
 
hi Pete,
How can you ensure an Unbound text box in a Form has some data written into
it before it is closed i.e. an entry is required? Some enlightenment would be
much appreciated.
Does this makes sense? You may use the Form Unload event:

Private Sub Form_Unload(Cancel As Integer)

Cancel = (Len(Trim(Nz(yourTextBox.Value, ""))) = 0)

End Sub



mfG
--> stefan <--
 
Thanks, I have used the idea you have given me, and now a message appears
when the record is saved if the textbox has remained Null.
 
Back
Top