Append Records from an Access Table to SQL Server Linked Table

Steven Deetz

Registered User.
Local time
Today, 08:51
Joined
Jul 19, 2001
Messages
49
I am rebuilding an application for a client and I have an Access table that I am using as a temporary table. Once the user is done entering information into the temporary table through a form, the user presses an update button that appends the records using an Append Query in Access to an SQL Server Table.

The following error message occurs:

"ODBC -- insert on a linked table 'linked tblname' failed.

[Microsoft][ODBC SQL Server Driver][SQL Server] Explicit value must be specified for identity column in table 'linked tblname' when IDENTITY INSERT is set to ON. (#545)

I am using a form, subform combination to record a bill with many details. The bill summary is posted into a tbl_TransactionsMain table in SQL Server using the ADO AddNew method. The PK for the tbl_TransactionsMain is then entered into the temporary table in Access. When the temporary table records are appended into tbl_TransactionDetail the error message occurs.

What is also interesting is while typing out this post I thought to test the error by manually trying to run the query. The query worked like a charm! :confused: When the orginal error occurred off of the form I tried to run the query manually and it failed. I am guessing that this might have something to do with the ODBC timeout.

I think SQL Server/ODBC connection is not liking how I have a set of records in an Access table with foreign key numbers assigned when I am attempting to append the records. I am new to SQL Server and any ideas are most appreciated! :)
 
The append query appears to be working properly right now. I think the ODBC connection had something to do with the query failure. I had previously edited the fields in the SQL Server based table and then in Access deleted the link and manually re-created the link through a DSN.

I do not quite get how a query attaches itself to an ODBC linked table for inserting data:confused: , but it appears that when the link was refreshed the append query started working.:)
 

Users who are viewing this thread

Back
Top Bottom