Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Order of ValidationRule checking...

Status
Not open for further replies.

BigTeeJay

Technical User
Jun 13, 2001
106
US
Greetings again, I hope this board doesnt have a limit
on the number of foolish posts... I may be reaching it.

I have yet another question that I fear will be an all
too obvious answer, but for the life of me cant find it
(and the Help file seems to contradict reality).

Here is what is happening. I have a table based form
(all the controls in this form are linked to a customer
table). This form has txtboxes for Name, Address, City,
State, Zip, etc.

An example of my problem is this. In my table I have
the Zip code field as a long int (so it can hold the
numeric equiv of a zip code). In my form I am trying
to validate any data entry, and give an appropriate err
msg (rahter than the generic one Access provides).

If I enter a letter for the zip code and try to change
to another control, I get a message saying that I am
violating the data-type for the field that this control
is bound to. Its ignoring the validation I have setup
for the control!

Some examples of validation I have tried for the control
(and none have caught/fired/)....
Code:
>9999 And <99999 or is null
Like &quot;?????&quot; or is null
(IsNumeric([Zip])=True And Len([zip])<6) Or Is Null
...but none of these seem to be working (at least not
before the validation for the underlying table is firing
).

I thought of using form_before(update/insert) but this
will only do validation for the first control correct?
These events are fired off when the first control is
altered, and wouldnt be fired off again (to check each
control as it is altered).

The help file states that (quoted)...
[tt]
Order of Validation for controls and fields

Validation rules for controls and fields are evaluated
in the following order:

1. Macro or event procedure validation (for example,
a macro or an event procedure that responds to the
BeforeUpdate event of the control or the form containing
the control)

2. The control's ValidationRule property

3. The underlying table's validation rules for the
field (as set in the field's ValidationRule, Required,
and AllowZeroLength properties)


4. The underlying table's ValidationRule property
(this property performs validation on records)
[/tt]

Ideas?
Travis
 
Why mess with a validation rule, when in this case, an INPUT MASK would serve your purpose admirably.

First, I'd convert the Zip guy to text field, 10 chars long. Then I'd set up the input mask of 00000/-0000;;# ( 5 inputs required, must be numeric, 4 inputs optional, must be numeric, placeholder of #)


78.5% of all statistics are made up on the spot.
Another free Access forum:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top