Control Validation Rule

  • Thread starter Thread starter Kyle Jedrusiak
  • Start date Start date
K

Kyle Jedrusiak

I'm using Access 10.x (Office XP) and SQL 8.x (2000).

I have a table designt that allows NULLs in a field due to issues with old
data.

If the user is entering a new record I would like to force them to select a
value.

I though I could use the control's validation rule propery.

The rule doesn't see to run as I go off the empty field for a new record.
But if I enter some data, then delete it, the rule does run.

Kyle!
 
Kyle Jedrusiak said:
I'm using Access 10.x (Office XP) and SQL 8.x (2000).

I have a table designt that allows NULLs in a field due to issues with old
data.

If the user is entering a new record I would like to force them to select a
value.

I though I could use the control's validation rule propery.

The rule doesn't see to run as I go off the empty field for a new record.
But if I enter some data, then delete it, the rule does run.

Correct, a Validation Rule will not work reliably here. Put a test in the
Form's BeforeUpdate event that displays a message and Cancels the update if
they don't make an entry.

EX:

Private Sub Form_BeforeUpdate(Cancel As Integer)

If Len(Nz(Me!ControlName,""))=0 Then
MsgBox "You must make an entry for Whatever"
Cancel = True
End If

End Sub
 
Back
Top