Kent Belan wrote:
Hello,
I am trying to create a generic report preview / print form in VFP9.
Has anyone done this and willing to share before I start mine?
Thanks,
Kent
Hi, Kent.
Here's the method I call (created from ProFox tips of the past):
PROCEDURE ShowReport(tcRpt as String, tcCaption as String, tlSkipPreview
as Logical, tlSkipPrompt as Logical)
* mjb 01-24-05 using Fred Taylor's idea for showing report inside max
window (courtesy ProFox archives)
* mjb 04-04-06 added tlSkipPreview and tlSkipPrompt clauses
LOCAL loFrm as Form, loException as Exception
CLEAR && mjb 04-12-06 get rid of any screen echos
TRY
IF !tlSkipPreview THEN
loFrm = CREATEOBJECT("Form")
WITH loFrm
.Caption = tcCaption
.WindowState = 2 && Maximized
.Show()
IF !tlSkipPrompt THEN
REPORT FORM (tcRpt) TO PRINTER PROMPT NOCONSOLE
PREVIEW WINDOW (.Name)
ELSE
REPORT FORM (tcRpt) TO PRINTER NOCONSOLE PREVIEW
WINDOW (.Name)
ENDIF && !tlSkipPrompt
ENDWITH && loFrm
loFrm.Release()
ELSE && no preview window (form)
IF !tlSkipPrompt THEN
REPORT FORM (tcRpt) TO PRINTER PROMPT NOCONSOLE
ELSE
REPORT FORM (tcRpt) TO PRINTER NOCONSOLE
ENDIF && !tlSkipPrompt
ENDIF && !tlSkipPreview
CATCH TO loException
MESSAGEBOX(loException.Message,16,"Problem generating report.")
ENDTRY
ENDPROC && ShowReport(tcRpt as String, tcCaption as String,
tlSkipPreview as Logical, tlSkipPrompt as Logical)
--
Michael J. Babcock, MCP
MB Software Solutions, LLC
http://mbsoftwaresolutions.com
http://fabmate.com
"Work smarter, not harder, with MBSS custom software solutions!"
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.