OK, triggers are reactive, DUHHHHHHH!
I was comparing and contrasting to constraints, so why the
"DUHHHHHHH!" here? I also said 'constraints are declarative', another
blatant statement of fact, but that didn't get a "DUHHHHHHH!" from
you. Perhaps we're suffering a culture clash
In case the point was lost, the SQL language is declarative and set
based whereas triggers are reactive and procedural, hence not a great
fit on that basis.
If I change Col1 and Col3 depends on
Col1, I should update Col3.
in a bound form, when I change the
value of Col1, it attempts to change that value in the table (which would
violate the check constraint) and therefore should generate an error.
The constraint is to stop bad data from reaching the base table so job
done. Your job as front end coder is to either trap the bad data
before it gets sent to the DBMS or handle the error the DBMS
generates. Sounds like your (hypothetical) form is writing data to the
DBMS too early.
Sure, I'd like triggers in the Access/Jet engine but all we have are
constraints and Validation Rules
I get an error (Invalid SQL Syntax - cannot use multiple columns in a
column-level check constraint) within Access 2003. How would you implement
this validation rule within Access
It's a quick example in vanilla standard SQL. Do you need to execute
it directly as posted to understand it? If so, you could execute it in
the Access user interface via ANSI-92 Query Mode (http://
office.microsoft.com/en-gb/access/HP030704831033.aspx); ensure you are
putting a comma between the column definition and the constraint
definition in the CREATE TABLE statement because all CHECK constraints
in Access/Jet are table level (well you can code them to refer to the
'current' row but I wouldn't recommend for too many reasons to post
here). Or you could take my aforementioned advice, "use a Validation
Rule in place of that CHECK constraint," the implementation of which
would be a record (row) level Validation Rule (a.k.a. Table Validation
Rule) and would probably look like this:
([col3]) = (([col1]) + ([col2]))
Now that I have suggested two ways of implementing this simple example
in Access, are you now in a position to confirm whether there are or
are not any "ways around the data entry process" short of dropping the
CHECK/Validation Rule to make col3 become anything other than col1 +
col2? TIA.
we are talking about Access in
this group, not SQL SERVER.
Both the OP and yourself mentioned SQL Server in this thread before I
did so why pick on me for replying?
Jamie.
--