Dear All,
While accessing the data from Access i have written the following code in Navision i have two problems in the following code
1) when the data is pulled the first character of the first field is always missing like my first field is Empcode then if code is MP0001 then only P0001 is pulled same is for all the rows.
2) I have three fields in the table both in the Access and the navision table When Ever i write the query 'Select EmpCode, EmpName From Employee' the following error is flashed out "Call to the member Item Failed Fields written the following message: Item Cannot be found in the corresponding collection to the requested name." But it wrks properly when i select all the fields of the table.
My Code is
Constr := 'Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Access To Navision\Amantest.mdb;' +
'User Id=admin; Password=;';
StrSql := 'Select EmpCode, EmpName From Employee';
CREATE(varRecordSet);
varRecordSet.Open(StrSql, Constr);
varRecordSet.MoveFirst;
RecordVar.OPEN(50001);
REPEAT
varFldCollection := varRecordSet.Fields;
RecordVar.RESET;
RecordVar.INIT;
FOR i := 1 TO RecordVar.FIELDCOUNT DO BEGIN
FieldVar := RecordVar.FIELDINDEX(i);
FieldVar.VALIDATE(varFldCollection.Item(i-1).Value);
END;
RecordVar.INSERT;
cFlag := 1;
varRecordSet.MoveNext
UNTIL varRecordSet.EOF = TRUE;
IF cFlag = 1 THEN
MESSAGE('Data Imported');
varRecordSet.Close;
RecordVar.CLOSE;
CLEAR(varRecordSet);
CLEAR(RecordVar);
Please Help... #-o
Aman Kumar Gupta
0
Answers
Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\mydatabase.mdb;Uid=Admin;Pwd=;
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Thanks,
Have you tried to do it in VB and see if you get the same problem?
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Well that i will check and tell you.. But i am facing a serious problem while importing the Decimal fields it is saying that this data type is not supported by the C/Side is it that we cant pull the decimal values from the Access.. Please don't say no. I need 2 pull the decimal, Integer values from Access how could i do so..
viewtopic.php?f=5&t=2407
viewtopic.php?f=23&t=28733 <-- Ui, it's a post from you ......
FieldVar := RecordVar.FIELDINDEX(1);
FieldVar.VALIDATE(varFldCollection.Item(0).Value);
FieldVar := RecordVar.FIELDINDEX(2);
FieldVar.VALIDATE(varFldCollection.Item(1).Value);
FieldVar := RecordVar.FIELDINDEX(3);
FieldVar.VALIDATE(varFldCollection.Item(2).Value);
FieldVar := RecordVar.FIELDINDEX(4);
FieldVar.VALIDATE(varFldCollection.Item(3).Value);
RecordVar.INSERT;
This is really :bug:ing me....
Select EmpCode, EmpName From Employee, cast(MyDecimal, as float) ';
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
I have the table known as Employee with salary as the decimal field so my query should be like this Select EmpCode, EmpName, Salary From Employee Cast(salary, As Float).
I tried this but still not wrking.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
I have already tried this but its wroking perfectly in sql server but when i run this command for the access or through my Navision program its showing the error " Syntax error (missing operator) in the query expression CAST(Salary AS Float)"
Thanks
Final its done actually as i am pulling data from access cast command was nt running properly then i used CDbl function in my query it worked
'Select EmpCode, EmpName, Cdbl(Salary), Check From Employee'; \:D/
thanks for the support...
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n