Can you use, user defined functions in Access for validation rule

  • Thread starter Thread starter RAM
  • Start date Start date
R

RAM

I have a data base that uses alot of forms that require date to be a any date
format or offeset days like +5d (short for +5 days)
currently I am using regular expressions in in conjuction with isdate()
function to validate. The problem is that I can not stop erroneous data
entering the data base. I can only alert the user of the error.
Any work around will be approciated.
 
RAM said:
I have a data base that uses alot of forms that require date to be a any
date
format or offeset days like +5d (short for +5 days)
currently I am using regular expressions in in conjuction with isdate()
function to validate. The problem is that I can not stop erroneous data
entering the data base. I can only alert the user of the error.
Any work around will be approciated.


I'm not sure I fully understand the requirements as described, but I can
answer at least part of the question. You can use a user-defined function in
a control validation rule, but not in a field or record validation rule.
Here's a quote from the help file ...

<quote>
For controls, you can set the ValidationRule property to any valid
expression. For field and record validation rules , the expression can't
contain user-defined functions, domain aggregate or aggregate functions ,
the Eval function, or CurrentUser method, or references to forms, queries,
or tables. In addition, field validation rules can't contain references to
other fields. For records, expressions can include references to fields in
that table.
</quote>
 
I have a data base that uses alot of forms that require date to be a any date
format or offeset days like +5d (short for +5 days)
currently I am using regular expressions in in conjuction with isdate()
function to validate. The problem is that I can not stop erroneous data
entering the data base. I can only alert the user of the error.
Any work around will be approciated.

Use the Form's or the date control's BeforeUpdate event, and set its Cancel
argument to True to prevent the update from occuring.

You can do this on a form, but not with a field or table validation rule.
 
Back
Top