Writing to Access from Navision 2.6F

The code below is my attempt to write back to a Access Database. The error message I get says that the recordset I am using does not support updating. I tried using the open method with the numeric value of 2 which corresponds to “adOpenDynamic” in access. CREATE(OBJdbconnection); OBJdbconnection.Open(‘TEST’,‘Admin’,’’); CREATE(tblTest); SQL := ‘SELECT DocumentNbr, Date, CustomerNbr FROM tblTest’; tblTest.Open(SQL, OBJdbconnection,2); tblTest.AddNew; tblTest.Fields().Item(‘DocumentNbr’).Value := ‘ABC123’; tblTest.Fields().Item(‘Date’).Value := 010103D; tblTest.Fields().Item(‘CustomerNbr’).Value := ‘123ABC’; tblTest.Update; tblTest.Close; OBJdbconnection.Close; CLEAR(OBJdbconnection); CLEAR(tblTest);

Is the constant “2” the correct value to return a recordset that is editable?

Locktype := 4; Regards,

Thanks for your help Apertierra. Could you give me the datatype that you used? It looked like an integer. However, I got an error message that said it was the wrong data type. Could you give me an example of the call such as: tblTest.Open(SQL, OBJdbconnection,4);

var DataConnection : Automation 'Microsoft ActiveX Data Objects 2.0 Library'.Connection DataRecordSet : Automation 'Microsoft ActiveX Data Objects 2.0 Library'.Recordset CREATE(DataConnection); DataConnection.ConnectionString := 'DBQ=C:\Test.mdb;DRIVER={Microsoft Access Driver (*.mdb)}'; DataConnection.Open; CREATE(DataRecordset); DataRecordset.ActiveConnection := DataConnection; DataRecordset.CursorType := 1; DataRecordset.LockType := 4; DataRecordset.Open('myTestTable'); IF NOT (DataRecordset.BOF AND DataRecordset.EOF) THEN BEGIN DataRecordset.MoveFirst; REPEAT DataRecordset.Delete(1); DataRecordset.MoveNext UNTIL DataRecordset.EOF; END; DataRecordset.AddNew; DataRecordset.Fields.Item(0).Value := myValue0; DataRecordset.Fields.Item(1).Value := myValue1; DataRecordset.Fields.Item(2).Value := myValue2; DataRecordset.Fields.Item(3).Value := myValue3; .... DataRecordset.Update; DataRecordset.UpdateBatch; DataRecordset.Close; Regards,