Little Doubts with Reports - Tables Area...........

Hi there,

I have a problem with my reports preview. Actually I used a free Table and its used in area12
[Select 12] in a form. And the Report - Preview is through a command button of a Form…
In Command- Window the report is working good [ie. . Do form “abcd1.scx”].

At the same time after compiling EXE, if I click the button its’ saying error something like…
……….. “File Does not exist”
But if I run through the command window …its running very properly…no errors….
My codings in the Preview Button is following…

USE hd_wkassign AGAIN IN 12 EXCLUSIVE
SELECT 12
GO top
SET FILTER TO
GO top
SET FILTER TO en_date=medt1
GO top
INDEX on super_id TO spspspid2
REINDEX
GO top
SET REPORTBEHAVIOR 90
LOCAL PviewCon1, ax AS ReportListener
DO (_REPORTPREVIEW) WITH PviewCon1
PviewCon1.Caption = 'PIS Special Report'
PviewCon1.ZoomLevel = 5
PviewCon1.ToolbarIsVisible = .F.
ax = CREATEOBJECT('ReportListener')
ax.QuietMode = .T.
ax.DynamicLineHeight= .T.
ax.AllowModalMessages = .T.
ax.ListenerType = 1
ax.PrintJobName = "AL MASHARIQ - Foreman's Work Program"
ax.PreviewContainer =PviewCon1
SET SYSMENU off
thisform.WindowState = 2
REPORT FORM "C:\My_Development\Time_Sheet\employees work program_1.FRX" PREVIEW OBJECT ax NOWAIT
PviewCon1.oForm.Toolbar.Dock(0)
PviewCon1.oForm.WindowState = 2
PviewCon1.oForm.ICON="c:\my_development\my_icons\note04.ico"
-

I feel may be I have to specify the area of table to open in the report …. …may be is it that error?
Kindly give me an idea to rectify this problem….
With Regards PARAMU

[1727 byte] By [Paramu] at [2008-1-10]
# 1

Hi Paramu,

Probably you can check if the current path is set the folder which contains the free tables. Always try to use some placeholders for Path of the table. You can set them in the main program.

Code Snippet

mdata_dir="c:\Test_app\Data\"

USE &mdata_dir\item_mst

(Hope this helped.... )

Best regards,

Markish

Markish at 2007-10-3 > top of Msdn Tech,Visual FoxPro,Visual FoxPro General...
# 2

Instead of

do (_REPORTPREVIEW) ...

use:

do ("C:\PROGRAM FILES\MICROSOFT VISUAL FOXPRO 9\REPORTPREVIEW.APP")

or just:

do ("REPORTPREVIEW.APP")

which that system variable points to and include that in your project.

PS: I don't know if you can redistribute that app. Check restrictions.

Never do something like:

do &path\filename

but:

do (addbs(m.path)+m.filename)

(Sorry Markish but that would lead to errors).

CetinBasoz at 2007-10-3 > top of Msdn Tech,Visual FoxPro,Visual FoxPro General...
# 3

Not a problem Cetin. I learn from my mistakes. Thanks anyhow. I'm learning.

(Cetin, the error you pointed out occurs when the 'mpath' contains any spaces...Is it the one ? or else please let me know if anyother can occur. )

Best regards,

Markish

Markish at 2007-10-3 > top of Msdn Tech,Visual FoxPro,Visual FoxPro General...
# 4
<<Actually I used a free Table and its used in area12 [Select 12] in a form. >>

I just want to point out that it's not a good idea to refer to work areas by number. You can always reference a work area by the alias of the table open in that area. When you write code without referring to work area numbers, your code is a lot more resilient.

To open a table:

USE MyTable in 0

From then on, you can refer to that table/workarea as MyTable:

SELECT MyTable

REPLACE Fred with "Ethel" IN MyTable

and so on.

Tamar

TamarE.Granor at 2007-10-3 > top of Msdn Tech,Visual FoxPro,Visual FoxPro General...
# 5

Hi CetinBasoz, Markish, Tamar

Yah...After giving the ReportPreview file location...the problem is solved and working very nicely.

Really honour will be in honourable place.....Atleast take my Thanks....

Thanks for all reply

With Regards....PARAMU

Paramu at 2007-10-3 > top of Msdn Tech,Visual FoxPro,Visual FoxPro General...
# 6

Hi Paramu,

You please check whether your project has included the class libs of report listners. Now go to report designer code page in data environment and write the code for --open table and filter-- in the "Before open table" method. Hope this may help you.

Best wishes.

Oru Kutian

Orkutian at 2007-10-3 > top of Msdn Tech,Visual FoxPro,Visual FoxPro General...