Is there a way to make changes to a report in the manner below after
the executable is made? I'd like to parse the report according to the
user's selections. Thanks
***********code - not mine
LOCAL ARRAY laForms[1], laLinesToWipe[1], laSettings[1]
LOCAL lnCurForm, lnFormCount, llNeedsCompiling, lcOldDir,
lnNamesOnLine, ;
lcOldFont, lnNumSettings, lcTargSetting, lnLoop, lcNewExpr
*----------------------------- Program Code Begin
-------------------------
-
#define MAX_LINE_NAMES 4
#define NAME_WIDTH 28
lcOldDir = ALLTRIM(SET("DEFAULT")+ALLTRIM(CURDIR()))
IF !EMPTY(tcWhere) AND TYPE("tcWhere") = 'C'
set default to (tcWhere)
ENDIF
CLEAR
CLOSE TABLES ALL
IF MessageBox("About to clear printer info from all reports
in"+CHR(13)+CHR(13)+ ;
ALLTRIM(CURDIR())+CHR(13)+CHR(13)+ ;
"Go for it?",36,"Mass Report Update!") != 6
WAIT "Aborted." WINDOW TIMEOUT 1
set default to (lcOldDir)
RETURN .F.
ENDIF
lcOldFont = _SCREEN.FontName
_SCREEN.FontName = "Courier New"
lnNamesOnLine = 0
*
* Identify lines in FRX expr field to wipe out:
*
DIMENSION laLinesToWipe[3]
laLinesToWipe[1] = "DRIVER="
laLinesToWipe[2] = "DEVICE="
laLinesToWipe[3] = "OUTPUT="
*
* For each FRX file in the current directory:
*
lnFormCount = ADIR(laForms,"*.FRX")
ASORT(laForms,1)
FOR lnCurForm = 1 TO lnFormCount
llNeedToCompile = .F.
*
* Open the form as a table:
*
USE (laForms[lnCurForm,1]) IN 77
SELECT 77
*
* The first record has the printer info:
*
LOCATE
IF !EMPTY(tag) OR !EMPTY(tag2)
llNeedToCompile = .T.
ENDIF
*
* Clear the tag fields:
*
REPLACE tag WITH "", ;
tag2 WITH ""
*
* Remove the printer info from the expr field:
*
lnNumSettings = ALINES(laSettings,expr,.T.)
lnLoop = 1
DO WHILE lnLoop <= lnNumSettings
lnInc = 1
FOR EACH lcTargSetting IN laLinesToWipe
IF lcTargSetting $ laSettings[lnLoop]
llNeedToComile = .T.
ADEL(laSettings,lnLoop)
lnNumSettings = lnNumSettings -
1
lnInc = 0
ENDIF
ENDFOR
lnLoop = lnLoop + lnInc
ENDDO
lcNewExpr = ""
FOR lnLoop = 1 TO lnNumSettings
lcNewExpr =
lcNewExpr+ALLTRIM(laSettings[lnLoop])+CHR(13)+CHR(10)
ENDFOR
REPLACE expr WITH lcNewExpr
*MessageBox("Before: "+chr(13)+expr+chr(13)+chr(13)+"After:
"+chr(13)+lcNewExpr)
IF lnNamesOnLine < MAX_LINE_NAMES
??
PADR(ALLTRIM(laForms[lnCurForm,1])+IIF(llNeedToCompile,'*',''),NAME_WIDTH)
ELSE
?
PADR(ALLTRIM(laForms[lnCurForm,1])+IIF(llNeedToCompile,'*',''),NAME_WIDTH)
lnNamesOnLine = 0
ENDIF
lnNamesOnLine = lnNamesOnLine + 1
SELECT 77
USE
*
* Compile the FRX:
*
IF llNeedToCompile
COMPILE REPORT (laForms[lnCurForm,1])
ENDIF
ENDFOR
set default to (lcOldDir)
Marcel Jalbert seemed to utter in
news:22Wi7.289588$v5.29128506@news1.rdc1.ct.home.com:
- Hide quoted text -
- Show quoted text -
> I been working around a problem for years where a FoxPro report form
> fails to print to the selected printer or to the Windows default
> printer. Anyway to make a long story short, when I compose a report
> form for a printer that exists on the Desktop or Server the application
> always prints to that printer. I'm use VFP 6.0 sp4 and have seen this
> problem on Windows 95 and NT desktops and VFP 5.0. By compose I mean;
> Modify the Report, go to "Page Setup" select a printer, click OK and
> save the report form. There appears to be some hard coding in the
> report form that identifies the printer name the report form was
> designed for. If this printer name exists this hard coding seems to
> override the destination printer settings your application would
> normally print to. There are a couple of ways I get around this
> problem.
> 1) Temporarily change the name of the printer you want to compose the
> report form for, select the printer while editing the report from and
> save it. Recompile your code and rename the printer back to it usually
> name. You can't rename a printer with Windows NT.
> 2) Variations on the same theme that works with Windows NT would be to
> temporarily install a printer on the PC that the application will never
> printer to. Compose the report form for that printer, save it,
> recompile and delete the installed printer.
> 3) Have multiple copies of your report forms. Each composed for the
> printers you want the reports to go to. (Not a desirable solution)
> Has anyone else seen this problem? Is it on a FoxPro bug list? Am I
> doing somethink I shouldn't or is there a better work around?
> Thanks!
> Marcel
--