Navision Error

Hi All,

when I am trying to move a file from one folder to another the files are not copying when I am using the following code.

FileRec.RESET;

FileRec.SETFILTER(Path,’%1’,‘C:\Users\trident\Desktop\Item Images’);

FileRec.SETFILTER(Name,’%1’,STRSUBSTNO(’%1.bmp’,“Item No.”));

FileRec.SETRANGE(“Is a file”,TRUE);

IF FileRec.FINDFIRST THEN

REPEAT

FILE.COPY(PicFileName,‘C:\Users\trident\Desktop\Item Images\Archive’);

FILE.ERASE(PicFileName);

UNTIL FileRec.NEXT=0;

I am getting an error saying the operating system couldnt find the drive specified by C:\Users\trident\Desktop\Item Images\Archive’.

Please help!!!

At what point in your code do you get the error?

if you run the code on the server, where the nav service resides, it should work.

if you run the code from a client computer, then you have the problem, that the server knows nothing about the client file structure.

When i am putting the removing

FileRec.SETRANGE(“Is A File”,TRUE);

If I am using this the code executes but the files are neither copied nor removed from the destination folder.

I am running the code on the server.

Regards,

Nikhil Toor

could be a folder permission problem, because you use subfolders in a user folder. try to use c:\temp as base folder instead.

Hi Jonathan,

The error was resolved by just putting

If EXISTS() then

Thanks for the suggestions.

Regards,

NIkhil Toor