Control Validation

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

What is the best expression to use in the Validate property for a control to
test that some text (of unconstrained length) has been entered.
 
Open the table in design view, and set the field's Required property to Yes.

If you prefer to use the Validation Rule of the field in the table:
Is Not Null

If you want to do it in a form, use the BeforeUpdate event of the form to
test it the control IsNull(). You cannot merely use the Validation Rule of
the control, since that is not triggered if nothing is entered.
 
I am currently using the the following code in the beforeupdate event,

Private Sub DESCRIPTION_22_BeforeUpdate(Cancel As Integer)

If IsNull(DESCRIPTION_22) = True Then
MsgBox "Enter text"
Cancel = True

End If

End Sub

I have found that the validation does not take place until the field has had
a value in it. When a new record is created i find that you can tab out of
the control without entering any text. Only when text has been added and
deleted does the validation event occur.
 
Yep: exactly what we said.
The events of the control won't work.

Use the *form's* BeforeUpdate event (not the control's event), or the field
properties in the table.
 
Back
Top