validation Rules

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

Guest

How can we apply the valdation rule to the new records only.

This means that the old ones should not be affected by this rule at all
 
You cannot do that at the table level.

You could do it in the BeforeUpdate event procedure of the form, e.g.:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.NewRecord Then
'apply your rule

However, this does not sound like a very useful thing to do. Any user would
soon learn that they can save the new record (so it's now an old one), and
then immediately put in the bad data.
 
Hi I am doing a mock exam for one of the qualifications called ECDL Adv and
teh question is something like this:

Open the sales table and create a validation rule that will not allow the
input of a date into the Date of Joining field that is earlier than 2005.
Create the following validation text message: No recruitment until 2005.
APPLY THIS RULE TO NEW DATA ONLY.

Creating the validation rule and the text is simple. But the thing is that
the question expects us to change the the dates of the existing records which
are prior to 2005 which the user might have entered in error and so therefore
should be able to change without that Validation rule coming into effectfor
the existing records.

I hope this is more clear in understanding my query!!

Kind Regards

Rajeev Rawat
 
No, I'm not clear what they are after either.

When you create a validation rule on a table field, Access asks whether you
want to check the existing records to see if they meet the rule. Perhaps
they are just asking you to answer No to that question.

Otherwise the request is ill-defined. You would perhaps need a field to
indicate the date when the record was added, and apply the rule only to
records that were entered after a certain date. It would be possible to use
the Validation Rule on the Table (in the properties box), not on a field, to
enforce such a rule.
 
Back
Top