Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP6 - image on Report 1

Status
Not open for further replies.

button71

Programmer
Nov 8, 2006
69
AU
I have just changed my app to operate out of Application Data\appFolder in readiness for Vista.

I have a number of FoxPro reports that have an image for each record referenced by a filename without pathing in the field (iname) eg test1.jpg.

The original report files are installed in the Program Files\App Folder and copied to a common name in the App Data folder when called and 'hacked' for paper sizes ( Letter and A4)

For the last 3 years these reports have run out of the Program Files\App Folder without any trouble with the images in that same folder.

I now create the images in the newfolder (app data) as the common report file.

Now I get a 'File or Path not found' error when I try to run the report. When I remove the image from the report file it runs without error ( and without image)

Is there any other way to reference the filename in the iname field?

Many thanks

William
 
Mike,

Thanks to your advice elsewhere I now have the report running in my development environment but not from the exe.

However - I had been using set defa to (mydatapath) prior to calling the report which didn't allow it to run.

So I'm unclear as to the difference in :

set default and set path.

Does a 'set default to' cancel a number of paths already set?

Can you point me to a good explanation? Maybe I've been lucky using different set defaults in my code.

I should have got the SET PATH TO sorted out earlier obviously.

Regards

William.
 
William,

I agree this can be confusing. I'll try to explain.

SET DEFAULT establishes the default directory. You can only have one default directory at any one time. So issuing SET DEFAULT not only establishes a new default directory, it also cancels the previous one.

The default directory serves the following purposes:

1. It is the place where all new files are created (if you don't explicitly include a directory path in the relevant command). This affects such commands and functions as CREATE TABLE, STRTOFILE(), CREATE FORM, and many others.

2. Any relative paths that you refer to in any command or function are treated as relative to the default directory. For example CREATE FORM MyForms\Customers will create the Customers form in the MyForms folder, which is a sub-directoy off the default directory.

3. When VFP needs to open a file (of any kind), and you don't explicitly mention the path, it will look first in the default directory.

By contrast, SET PATH establishes the search path. The search path is a list of directories. You can have many directories in the list.

When VFP needs to open a file and you don't explicitly mention the path, it will first look in the default directory (as mentioned above). If it can't find it, it will then look in turn in each directory in the search path.

As an example, consider these commands:

SET DEFAULT TO c:\dev
SET PATH TO forms, tables, code, d:\backup
USE MyTable

To locate MyTable, VFP will first look in c:\dev (because it's the default directory), then in c:\dev\forms, c:\dev\tables and c:\dev\code (note that these folder are relative to the default) and finally in d:\backup (which is not a relative path).

SET PATH does not cancel any previous SET DEFAULT, but it does cancal any previous SET PATH. But you can avoid that by using the ADDITIVE keyword.

In your case, I suggested adding the images folder to your SET PATH so that the report can find the image there. This will not affect your default directory. It is just one more folder for VFP to look in.

I hope this makes sense, and that I haven't confused you even more.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Mike,

Thank you so much for such a lucid explanation.

Willaim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top