B
Bonno Hylkema
Dear friends,
I have a SQL Server database and an Access adp frontend. I use DRI
(declarative referential integrity) throughout, with one exception. I have a
table Projects in which I save the names of several people working on the
project, like analist, projectleader etc, a total of four names. These names
are taken from one table Employees. Since I want to have referential
integrity on four fields, DRI wil not help (only one allowed), so I am using
triggers instead.
I wrote the following trigger as an example, changing a FunctionCode in the
table Functions, and hoping that the table Employees will be updated
accordingly:
CREATE TRIGGER updFunctionCode
ON Functions
FOR UPDATE
AS
IF EXISTS (SELECT * from Employees, deleted WHERE Employees.FunctionCode
= deleted.FunctionCode)
UPDATE Employees
SET FunctionCode = inserted.FunctionCode
FROM inserted, deleted
WHERE Employees.FunctionCode = deleted.FunctionCode
When I am in the SQL Server environment (Query Analyzer) the trigger works
like a charm.
However when I am in the Access adp environment and I update a FunctionCode
in the table Functions I get the following Microsoft Office Access error:
"There are insufficient key columns data, or they are not correct. Too many
rows are affected by the update"
This error message is not the litteral english text, I had to translate it
from dutch. So if you don't understand it, I don't either.
The row is not updated in the Access datasheet of the table Functions, the
update mark stays on, after I hit the Escape key, the old value is still
shown. However after a requery of the datasheet the new value is shown and
the update was also succesful in the related Employees table!
It looks like the trigger works OK, but the update of the Access adp
frontend is fooled.
Has anybody any clue?
Thanking you in advance, Bonno Hylkema
I have a SQL Server database and an Access adp frontend. I use DRI
(declarative referential integrity) throughout, with one exception. I have a
table Projects in which I save the names of several people working on the
project, like analist, projectleader etc, a total of four names. These names
are taken from one table Employees. Since I want to have referential
integrity on four fields, DRI wil not help (only one allowed), so I am using
triggers instead.
I wrote the following trigger as an example, changing a FunctionCode in the
table Functions, and hoping that the table Employees will be updated
accordingly:
CREATE TRIGGER updFunctionCode
ON Functions
FOR UPDATE
AS
IF EXISTS (SELECT * from Employees, deleted WHERE Employees.FunctionCode
= deleted.FunctionCode)
UPDATE Employees
SET FunctionCode = inserted.FunctionCode
FROM inserted, deleted
WHERE Employees.FunctionCode = deleted.FunctionCode
When I am in the SQL Server environment (Query Analyzer) the trigger works
like a charm.
However when I am in the Access adp environment and I update a FunctionCode
in the table Functions I get the following Microsoft Office Access error:
"There are insufficient key columns data, or they are not correct. Too many
rows are affected by the update"
This error message is not the litteral english text, I had to translate it
from dutch. So if you don't understand it, I don't either.
The row is not updated in the Access datasheet of the table Functions, the
update mark stays on, after I hit the Escape key, the old value is still
shown. However after a requery of the datasheet the new value is shown and
the update was also succesful in the related Employees table!
It looks like the trigger works OK, but the update of the Access adp
frontend is fooled.
Has anybody any clue?
Thanking you in advance, Bonno Hylkema