Hi Bob
Thanks for your idea about using a temp cursor. I tried it, but cannot get it to print. The text merge letter is in TextHold but it insists on printing a list of the Database Table/DBF files. Here is the code in the OK button (after I have selected a mailmerge letter & a single person to run through the mail merge routine). Maybe you can spot what I'm doing wrong.
Bill
*===========OK Button======
local m.recno, afile, m.lctemp, m.count, lcHold
*--------------
if m.ToFile = .F. && ToFile prints to a disk file
m.filename = SPACE(20)
thisform.text1.refresh
CREATE CURSOR TextHold (lineid c(80))
afile = JUSTPATH(SYS(16,1)) + "\" + "TextHold"
else
afile = m.filename
endif
SET CONSOLE OFF
SET PRINTER OFF & as per Tamar's advice
SET TEXTMERGE TO (afile)
SET TEXTMERGE ON NOSHOW
WAIT WINDOW "Preparing report...Please wait" NOWAIT
SET TEXTMERGE DELIMITERS TO
SET MEMOWIDTH TO 80
IF thisform.prnscope.value = 1
\\<>
ELSE
IF NOT EMPTY(forexpr)
forexpr = "FOR "+forexpr
ENDIF
IF NOT EMPTY(whileexpr)
whileexpr = "WHILE "+whileexpr
ENDIF
SELECT (m.savearea)
m.recno = RECNO()
m.count = 0
SCAN &forexpr &whileexpr
if m.count > 0
\<>
else
\\<>
endif
m.count = m.count + 1
EJECT PAGE
ENDSCAN
GOTO RECORD m.recno
ENDIF
SET CONSOLE ON
SET PRINTER off
SET PRINTER TO
SET TEXTMERGE OFF
SET TEXTMERGE TO
if m.ToFile = .F.
WAIT WINDOW "Printing the report..." NOWAIT
SELECT TextHold
GETPRINTER()
LIST FILES TO PRINTER
endif
* modi file (afile) && use for preview button
IF AT("FOR",forexpr)<>0
forexpr = SUBSTR(forexpr, AT("FOR",forexpr)+4)
ENDIF
IF AT("WHILE",whileexpr)<>0
whileexpr = SUBSTR(whileexpr, AT("WHILE",whileexpr)+6)
ENDIF
m.ToFile = .F.
m.filename = SPACE(20)
thisform.refresh
SELECT letters
RETURN
*===========
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only