SQL Server 2000 Trigger problem in InfoPath 2007

C

Charles T D

I made a trigger on the table my form is based on and it never fires when
inserting records using InfoPath. It works fine when I insert data into the
table using script in Query Analyzer.
InfoPath correctly inserts the data but the trigger never fires as far as I
can tell. Any ideas or help would be appreciated.

-- Text of trigger.
CREATE TRIGGER [trgInsertStaff] ON [dbo].[tblVocationalTeams]
FOR INSERT
AS
If Update (Staff)
BEGIN

Declare @StaffID varchar(10)
Declare @StaffLength int
Declare @Position int

Select @StaffLength = Len(Inserted.Staff) from Inserted
Select @Position = CharIndex(':', Inserted.Staff) from Inserted
Select @StaffID = Right(Staff, @StaffLength - @Position) from Inserted

Update tblVocationalTeams Set
HarmonyID = WORKERS.MEMBERID,
StaffName = WORKERS.WLASTNAME + ', ' + WORKERS.WFIRSTNAME,
LastName = WORKERS.WLASTNAME,
FirstName = WORKERS.WFIRSTNAME
From tblVocationalTeams Inner Join WORKERS
On tblVocationalTeams.StaffID = WORKERS.STAFFID
Where tblVocationalTeams.StaffID = @StaffID

END

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top