ODBC --insert on linked table '....' failed.

mase112

New member
Local time
Today, 02:36
Joined
Nov 10, 2005
Messages
7
I have a *.mdb file whit linked mssql tabels.
When i try to insert a new row in a linked table whit a model, i get this error.
"Run-time error '3155': ODBC --insert on
linked table '.....' failed.

This is a part of my code that i am using:

nContractID = Forms!frmContracten!ContractID
sql = "SELECT * FROM tblContracten WHERE ContractID=" & nContractID
Set rstContractNu = db.OpenRecordset(sql, dbOpenDynaset, dbSeeChanges)
If (rstContractNu.EOF) Then GoTo Err_KanNietKopieren
If (MsgBox("Weet je zeker dat je contract '" & rstContractNu![Contractnummer] & "' wilt kopieren?", vbYesNo) = vbYes) Then
Set rstOrders = db.OpenRecordset("tblContracten", dbOpenDynaset, dbSeeChanges)
rstOrders.AddNew 'Is eigenlijk Contracten tabel
'rstOrders!InterneContactpersoonID = [InterneContactpersoonID]
rstOrders!FactuurAdresID = rstContractNu![FactuurAdresID]
rstOrders!Contractnummer = rstContractNu![Contractnummer]
rstOrders!Aantalbezoeken = rstContractNu![Aantalbezoeken]
rstOrders!Ingangsdag = rstContractNu![Ingangsdag]
rstOrders!MaandID = rstContractNu![MaandID]
rstOrders!Ingangsjaar = rstContractNu![Ingangsjaar]
rstOrders!Vervaldag = rstContractNu![Vervaldag]
rstOrders!Vervalmaand = rstContractNu![Vervalmaand]
rstOrders!Vervaljaar = rstContractNu![Vervaljaar]
rstOrders!ContractSoortID = 1
rstOrders![Contactpersoon] = rstContractNu![Contactpersoon]
rstOrders!Telefoonnummer1 = rstContractNu![Telefoonnummer1]
rstOrders!Telefoonnummer2 = rstContractNu![Telefoonnummer2]
rstOrders!Contractbijzonderheden = rstContractNu![Contractbijzonderheden]
rstOrders!Planningsmaand = rstContractNu![Planningsmaand]
rstOrders!FactuurmaandID = rstContractNu![FactuurmaandID]
rstOrders!Memo = rstContractNu![Memo]
rstOrders!ContractDatum = Date
rstOrders.Update

I get the error when i try to update and make a new row....

Whit not linked tables this works fine...

What must i do different ?????:confused:
 
mase112 said:
rstOrders!FactuurAdresID = rstContractNu![FactuurAdresID]

[...snip...]

What must i do different ?????:confused:

I *think* your recordset syntax is incorrect; try

rstOrders("FactuurAdresID").Value = rstContractNu("FactuurAdresID").Value
 

Users who are viewing this thread

Back
Top Bottom