Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using CmdButton to Print/Preview Report
Message
From
29/10/1998 16:05:29
 
 
To
29/10/1998 12:10:41
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00152391
Message ID:
00152515
Views:
20
>I have designed in intake form which uses a field called "Names.name_id" as the primary field Names table to like all other tables in the database. On my form I have a command button fror printing (and one for previewing) a report which basically prints out all the information on the intake form. The problem I'm having is this: sometimes it works fine (depending on which page of the form you are on, but sometimes the "Print Report" CmdButton will cause a report to print for every record in the database rather than just the record that is being displayed on the screen (which is the only record that should be printed). Also the "Preview Report" CmdButton displays the correct report but if you hit the printer icon with report displayed it prints reports for all records.
>
>The "Print Report" button has the following code in the click event: PreRepID = Names.name_id
> Report Form Intake.frx For Names.name_id = PreRepID To Printer
>
>The "Preview Report" click event is similar:
> PreRepID = Names.name_id
> Report Form Intake.frx For Names.name_id = PreRepID Preview
>
>Any suggestions?
>TIA
>--Lincoln

Lincoln,

Here's a way I often use for the same situation, assuming the table you want to print from is in the currently-open work area when the report command is issued:

rec=recno()
set filter to recno()=rec
report form whatever to print next 1
set filter to

If your view is already filtered when you go in, preserve the current filter by adding these lines:

currentfilter=set('filter')
rec=recno()
set filter to recno()=rec
report form whatever to print next 1
set filter to ¤tfilter.

The filter approach is very fast because you're already on the record you want to print so there's no repositioning of record pointers in the file.

HTH
Allen
Previous
Reply
Map
View

Click here to load this message in the networking platform