Hello , I got a task of creating a table in Navision which is already in MSAccess and Update its Contents as the data in Access Table Changes. I could Access most of the Fields into Navision Except for DateTime & Decimal by using ‘Microsoft ActiveX Data Objects 2.7 Library’. sample of the code is… Var: varConn ‘Microsoft ActiveX Data Objects 2.7 Library’.Connection varrecset’Microsoft ActiveX Data Objects 2.7 Library’.Recordset varfields’Microsoft ActiveX Data Objects 2.7 Library’.Fields recdb1 table with fields:num Text 30,dtm DateTime. dttest table in Access with Fields num Text,dtm DateTime CREATE(varConn); varConn.Open(‘datetimetest’);//MSAccess MDB CREATE(varrecset); varrecset.Open(‘dttest’,varConn);//dttest is table in MSAccess varrecset.Move((recdb1.COUNT)); WHILE NOT varrecset.EOF DO BEGIN varfields := varrecset.Fields; FOR x := 0 TO varfields.Count -1 DO BEGIN CASE UPPERCASE(varfields.Item(x).Name) OF ‘NUM’: recdb1.num:=varfields.Item(x).Value;//Text Field which is working fine END; CASE UPPERCASE(varfields.Item(x).Name) OF ‘DTM’: recdb1.dtm:=varfields.Item(x).Value;(x).Value;//DateTime Field in Navision & access //which doesn’t work END; END; varrecset.Close; varConn.Close; CLEAR(varrecset); CLEAR(varConn); Problem is with the line ‘recdb1.dtm:=varfields.Item(x).Value;(x).Value;’ which gives the error ‘The Expression Date Can’t be TypeConverted to DateTime Value.’ Tough I could Access the Date part of the DateTime Field in Access by Changing the table field in Navision to Date Field ,with the same Code. Could Anyone help me out in accessing the datetime Fields in MSAccess into Navision. Thanks.
I normally do this by evaluating the datetime into a text variable in navision, split it into date and time - then evaluate these parts into the relevant navision fields… Hope it helps.