Hi
I?m trying to create an error trap with a RULE and havingproblems making it 
work.

The structure:
VEH table: one row = one vehicle, Primary Key is VID
DRIVERS table: one row = one driver.The VID column is in the DRIVERS table.It 
is NULL if that driver currently is notassigned a vehicle.It is filled in if 
adriver is assigned a vehicle.
There already is an error trap in Drivers: VID is a Foreign Keyto the VEH table 
but it can be NULL.Thisworks fine.

I want to set up a rule that says that no TWO drivers canhave the same VID 
value.I can?t use theUNIQUE KEY option because this requires that a field be 
filled in, but it isvalid for VID to be NULL.

I tried this rule:
RULES 'Vehicle ID must be either blank or unique: twodrivers cannot be assigned 
to the same vehicle' FOR Drivers FAILS WHERE VID ISNOT NULL AND VID IN (SELECT 
VID 
FROM DRIVERS WHERE VID IS NOT NULL GROUP BY VID HAVINGCOUNT(*) > 1)

R:Base takes the rule, but the error trap does notwork.I am allowed to put in 
duplicatevalues.

Any ideas?

David Blocker

David Blocker
Email: [email protected]
Phone: 781-344-1920
Cell: 339-206-0261

Reply via email to