One works only when other not touched?  
Author Message
acf





PostPosted: Visual FoxPro General, One works only when other not touched? Top

Hi,

In single Table form there are "Report & Invoice" command buttons.

The problem is if "Report" execute once "Invoice" won't do anything and vise versa.

Also Is there any command that will preview the report in maximized size instead of clicking it every-time

 

"Report" command button code is:

REPORT FORM monthly.FRX PREVIEW

 

"Invoice" command button code is:

REPORT FORM invoice NEXT 1 TO PRINTER preview

 

Any help well greatly apprecite, Thanks



Visual FoxPro2  
 
 
CetinBasoz





PostPosted: Visual FoxPro General, One works only when other not touched? Top

report form command causes the record pointer to advance and in your print button code it says "next 1" when probably your record pointer is at eof().

Better do that like:

* Preview button

select ... from .... where ... into cursor crsReport

report form ... preview

* Print button

select ... from .. where .. into cursor crsReport

report form ... to printer

Actually since preview has a print icon in its toolbar I don't think you need 2 separate buttons to do this.

For your second question. You can define a window and show report in that window. ie:

Use employee
lcRepName = 'employee.frx'

Define Window Output ;
 FROM 1,1 To Scols(),Srows() ;
 SYSTEM Name oOUTPUT ;
 CLOSE Zoom

With oOUTPUT
 .Caption = "My report caption"
 .MaxButton = .T.
 .WindowState = 2
 .Show()
Endwith

Report Form (m.lcRepName) Preview Window 'OutPut'

If Vartype(oOUTPUT) = 'O'
 oOUTPUT.Release()
Endif

 
 
acf





PostPosted: Visual FoxPro General, One works only when other not touched? Top

Thank you cetinBasoz. I try the following and it didn't work.

SELECT invoice FROM "c:\documents and settings\visual foxpro projects\invoice.frx" INTO CURSOR crsReport

select ... from .. where .. into cursor crsReport

report form ... to printer

can you please specify, I only want to print a current record

and where should I define the window

I am just a biginner please be nice. Lots of thanks


 
 
Alex Feldstein





PostPosted: Visual FoxPro General, One works only when other not touched? Top

>SELECT invoice FROM "c:\documents and settings\visual foxpro projects\invoice.frx" INTO CURSOR crsReport

This command will select a field called invoice from a table called "invoice". You said it did not work. What did not work No records returned Any error messages Is that the name of the table and field

 

SELECT * FROM "c:\documents and settings\visual foxpro projects\invoice.frx" INTO CURSOR crsReport

will get you all columns (fields) in all rows, until you add a wehere clause to filter the result set (always recommended).

Once you have the record set you want, the you issue your REPORT FORM MyReport [TO PRINTER | PREVIEW]

as in Cetin's complete example.

Of course the report format has to be previously designed including columns and controls for every column in your data set that you want to show.

The Window in Cetin's example was to answer your question about deciding Preview vs. Print. You can put this info in a method of your form, or in the Click() method of a Print button.


 
 
Tamar E. Granor





PostPosted: Visual FoxPro General, One works only when other not touched? Top

Just add NEXT 1 to your REPORT FORM ... PREVIEW command. The problem is that right now, you have it reporting on all records, which moves the record pointer to end-of-file.

Tamar

 
 
acf





PostPosted: Visual FoxPro General, One works only when other not touched? Top

First of all thank you

I actually cannot translate properly because the "Invoice" button simply prints the report of the current record in "invoice.frx"

 

 

While the "Report" button preview the report file of "monthly.frx" in this report file there is Start_Date and End_Date program attached (found & follow VFP sample program)

 

Everything works fine until the "Report" pressed, once it happens, pressing any of “Next, Previous bottom etc.” will open up the window to open a Table file but if the Table opens exclusively or not soon after this message appears “Program Error No table is open in the current work area”