General information
Category:
Reports & Report designer
>Can you create a simple repro of the problem and email it to me?
Sergey
I have found the problem - it's hilarious.
1. Create a new blank project.
2. Create two subfolders: Progs, Reports
3. Save a new report with a 'Fruit' field as Reports\Report1.frx
4. Save the code below to Progs\Prog1.prg
5. Build and run the project (app or exe)
If you click 'No' the report runs fine. If you click 'Yes' you get the 'File does not exist' error - the app cannot see the report file in its subfolder when it's part of an EXECSCRIPT script, but it can when the name expression is used.
This may have been in VFP since EXECSCRIPT was introduced. I am resigned to imagine it is by design, although I cannot think why.
John Burton
#INCLUDE FOXPRO.H
CREATE CURSOR TestReportCursor (Fruit C(20))
INSERT INTO TestReportCursor (Fruit) VALUES ("Apples")
INSERT INTO TestReportCursor (Fruit) VALUES ("Oranges")
INSERT INTO TestReportCursor (Fruit) VALUES ("Pears")
DO WHILE .T.
n = MESSAGEBOX( ;
"Run the report." + CHR(13) + CHR(13) + ;
"Yes = Use the EXECSCRIPT syntax" + CHR(13) + ;
"No = Don't use it" + CHR(13) + CHR(13) + ;
"Cancel = Quit", ;
MB_YESNOCANCEL+MB_ICONQUESTION, ;
"Choose the method")
cReportFile = "Report1.Frx"
DO CASE
CASE n=IDYES
* cReportFile could be parameterised to any report file
EXECSCRIPT([REPORT FORM "] + cReportFile + [" TO PRINTER PREVIEW])
CASE n=IDNO
* ditto
REPORT FORM (cReportFile) TO PRINTER PREVIEW
CASE n=IDCANCEL
EXIT
ENDCASE
ENDDO
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only