Insert failed

M

Mark A. Sam

I am running the code below on two similar tables. They both have an
identity insert field and both have a timestamp. The first routine labeled
Insert Product Materials runs fine, the second, Insert products mateirals,
fails.
This is the error:

error 3155: ODBC -Insert on linked table 'Customer ST Products Tasks '
Failed.

****************************************
'Insert product's materials
strSQL = "INSERT INTO [Customer ST Products Materials] ( custProdID,
prodmatType, prodmatManuf, prodmatDesc, prodmatNotes, EntryDate,
TestRecord ) " & _
"SELECT " & newCustProdID & " AS custProdID, prodmatType,
prodmatManuf, prodmatDesc, prodmatNotes, #" & setEntryTime & "# AS
EntryDate, " & bolTestRecord & " AS TestRecord " & _
"FROM [Customer ST Products Materials] " & _
"WHERE ((([custProdID])=" & rstProds![CustProdID] & "));"

Debug.Print strSQL

CurrentDb.Execute strSQL

'Insert product's tasks
strSQL = "INSERT INTO [Customer ST Products Tasks] ( custProdID, prodTask,
[Benchmark Time], [Avg Time], EntryDate, TestRecord ) " & _
"SELECT " & newCustProdID & " AS custProdID, prodTask,
[Benchmark Time], [Avg Time], #" & setEntryTime & "# AS EntryDate, " &
bolTestRecord & " AS TestRecord " & _
"FROM [Customer ST Products Tasks] " & _
"WHERE ((([custProdID])=" & rstProds![CustProdID] & "));"


Debug.Print strSQL

CurrentDb.Execute strSQL

****************************************

If I open the table 'Customer ST Products Tasks ' I cannot enter a record.
I get this error:

ODBC -Insert on linked table 'Customer ST Products Tasks ' Failed.
[Microsoft][ODBS SQL Server Driver][SQL Server]Explicit value must be
specified for identity column in table 'Customer ST Products Tasks' when
IDENTIY_INSERT is set to ON (#545)

but if i open table 'Customer ST Products Materials' directly I can enter a
new record.

There are several other tables in this procedure with Indentity insert
fields and they aren't giving me any trouble.

Any help will be appreciated.

God Bless,

Mark A. Sam
 

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