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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Reports 1

Status
Not open for further replies.

coldan

Programmer
Oct 19, 2008
98
AU
I am putting my app together again after a 'botched' backup - 'nuff said.

I am having problems with my Reports - which previously worked like clockwork.

Now they work when debugging and not in the executable.

I am showing the Reports in a maximised window with a Page n from nn in the footer.

Can anyone see anything in the following code that may not be quite 'kosher'.

Code:
&&  main form already activated

Set Default To (mydatapath)

nTotalPages = 0


Define Window x From 1,1 To 20,20
Acti Window x


Report Form ('myreport.frx') All
* the first run should get us the
* number of pages and summary cursor...
* then:

nTotalPages = _Pageno
Release Window x

Activate Screen
Report Form ('myreport.frx') Preview Window ;
	(oRepForm.Name) To Printer Prompt
 
Coldan,

You say the reports are not working, but you haven't said why. What exactly is the problem you are seeing?

For your code snippet, I'd guess it has something to do with printing "Page N of M" in the report. If so, are you trying to use nTotalPages as a variable within the report?

If so, it's likely that the variable has gone out of scope when the report is running. You could try adding this line to the start of the code:

Code:
PRIVATE nTotalPages

That will ensure that the variable is visible in the report.

If this doesn't answer your question, please give more details of the nature of the problem.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
MIke,

Added your Private command - no different.

I see the report in the debugger as you would expect.

Running the exe I see

the form open maximised
The window at the top left -Window x From 1,1 To 20,20

Unlike in the debugger, this does not fill with the first run of the report and the second run doesn't fire either so I all I see is a 'flash' of the white form.

The report preview code and all other elements to get a report running are common routines.

In the exe one report fires correctly - 3 don't - but they all look OK in the debugger.

ie form opens
window is drawn
first run shows itself in the window
nTotalPages = _Pageno runs
second run shows maximised in the form.

I am now copying all the report frx etc into the working folder so I will now add an Environment to them and see how that goes.

I copy each frx to myreport.frx and thus my report preview is always working on the same report name.

I get all the awkward ones to try and describe - sorry.

Coldan
 
First, I don't see why you have the window x. What's it for?

Second, are you sure there are records to report on when you run the EXE? Reports won't display when empty.

Tamar
 
MIke,

Added your Private command - no different.

I see the report in the debugger as you would expect.

Running the exe I see

the form open maximised
The window at the top left -Window x From 1,1 To 20,20

Unlike in the debugger, this does not fill with the first run of the report and the second run doesn't fire either so I all I see is a 'flash' of the white form.

The report preview code and all other elements to get a report running are common routines.

In the exe one report fires correctly - 3 don't - but they all look OK in the debugger.

ie form opens
window is drawn
first run shows itself in the window
nTotalPages = _Pageno runs
second run shows maximised in the form.

I am now copying all the report frx etc into the working folder so I will now add an Environment to them and see how that goes.

I copy each frx to myreport.frx and thus my report preview is always working on the same report name.

I get all the awkward ones to try and describe - sorry.

Coldan
 
Sorry about the duplicate message...
Tamar,

Tamar,

>First, I don't see why you have the window x. What's it for?

This a snippet I was given some years to allow the report to run twice - I guess 'invisibly' the first time.

This code has been in my pp for years and everything works well in the 'old' exe that I am trying to recompile to make some small corrections to.

Coldan
 
Problem solved...

Mike's post led me to look at the actual reports which had worked in the distributed app.

I found another variable which was not visible to the reports in this build.

Thanks everyone.

Coldan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top