Date and time from Access to Navision

Hi, I’m dynamically extracting data from a Access database to Navision using ADO and Navision RecRef functionality i 3.60. My problem is concerning date fields in Access because they seem to include both date and time but is only recognized as a date datatype by Navision [?] Here’s the code: // lcVar is variant datatype; // date is date datatype; // time is time datatype IF lcVar.ISTIME THEN time := lcVar ELSE IF lcVar.ISDATE THEN date := lcVar; if the field in access only contains a date then lcVar correctly is evaluated as DATE and converted, but the 2 problems arise when: 1. the field only contains a Time. Navision still interpret it as a date and the value will be somthing like ‘31-12-1899’… [?] 2. if the field contains both a date and a time value it is still interpreted as a date but the convertion fails with a type mismatch… I’ve tried using DateTime instead but no luck there. any help or advice will be appreciated… [:)]

hi well, I figured out one way to solve the problem like this: date := VARIANT2DATE(lcVar); time := VARIANT2TIME(lcVar); IF (date<>0D) AND (date<>DMY2DATE(31,12,1899)) THEN // do processing of date IF Vartime<>0T THEN // do processing of time It’s not very fancy, but get’s the job done… [8D] Then I had a problem with dynamically assigning values to a field of datatype Time because Navision would not recognize Time as a valid datatype: RecRef.FieldIndex(i).Value(Time); // Error - Type mismatch… [?] it turns out that it’s expecting a Variant datatype so this will do the trick: Variant := Time; RecRef.FieldIndex(i).Value(Variant); // success! this i is a bit wierd, because if the field where of datatype date this ‘automatic’ type conversion would fail: Variant := Date; RecRef.FieldIndex(i).Value(Variant); // Error… RecRef.FieldIndex(i).Value(Date); // Success! but maybe that’s just me… [:)]