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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

BUG: Adding Records To .Adp form With Trigger For Insert On table

Status
Not open for further replies.

PWise

Programmer
Dec 12, 2002
2,633
US
I have A simple form to add records to a table. The table has A trigger for Insert. The Trigger inserts A record in a log table. After each record I add I get this error message

MsAccess Error Messege Box said:
The data was added to the database but the data won’t be displayed in the form because it doesn’t satisfy the criteria in the underlying record source.

The record source for the is either A tablename or A "Select Tablename.* from Tablename". If I requery the for the data shows up.

When I look in profiler I see these lines

SQL Profiler said:
SELECT @@IDENTITY
The next line is
SQL Profiler said:
exec sp_executesql N'SELECT * FROM ( SELECT * FROM "dbo"."Tablename" ) AS DRVD_TBL WHERE "FieldName" = @P1', N'@P1 int', 25

Now 25 is the PK value of the record in the log table. It seems that access is looking for @@IDENTITY the PK of the Log Table not SCOPE_IDENTITY( ) the PK of the main table

Any Ideas

Thanks In Advance

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top