Function OddEven Parameters tcReport, tcOddEven Select curReport Go Top Set ReportBehavior 90 loOddEvenListener = Newobject("OddEvenListener") loOddEvenListener.ListenerType = 1 &&Preview loOddEvenListener.icWhatToPrint = Upper(tcOddEven) Report Form (m.tcReport) Object loOddEvenListener Define Class OddEvenListener As UpdateListener Of "_reportlistener.vcx" icWhatToPrint = Upper(m.tcOddEven) Function IncludePageInOutput Lparameters tnPageNo Do Case Case tcOddEven = "ALL" Return .T. Othe Return (m.tnPageNo%2=1 And This.icWhatToPrint = "EVEN") Or (m.tnPageNo%2 = 0 And This.icWhatToPrint="ODD") Endcase EnddefineIn your call Report to Print function you write:
If This.Parent.chkOddEven.Value = .T. && a checkbox to control the PrintOddEven functionality m.lcMessage = "Print odd - pages" m.lcMessageCaption = "Make choice" m.lnAnswer = Messagebox( m.lcMessage, 3+32+0+0, m.lcMessageCaption, 0 ) && Yes = 6, No = 7 Do Case Case m.lnAnswer = 2 && Cancel Case Inlist(m.lnAnswer, 6, 7) m.llRet = .T. Endcase m.lcMessageCaption = "Please insert paper again" Do Case Case m.llRet = .T. And m.lnAnswer = 6 m.lcChoice = "ODD" Do printoddeven With m.lcReport, m.lcChoice m.lcPages = Alltrim(Transform(_Pagetotal)) m.lcMessage = "Odd pages printed ?"+Chr(9)+Chr(13)+"(total "+m.lcPages+" pages )" m.lnReady = Messagebox( m.lcMessage, 3+32+0+0, m.lcMessageCaption, 0 ) && Yes = 6, No = 7 If m.lnReady = 6 m.lcChoice = "EVEN" Endif Case m.llRet = .T. And m.lnAnswer = 7 m.lcChoice = "EVEN" Do printoddeven With m.lcReport, m.lcChoice m.lcMessage = "Even pages printed ?" m.lnReady = Messagebox( m.lcMessage, 3+32+0+0, m.lcMessageCaption, 0 ) && Yes = 6, No = 7 If m.lnReady = 6 m.lcChoice = "ODD" Endif Case m.lnAnswer = 2 Endcase Else m.lcChoice = "ALL" If !Vartype (_Screen.oFoxPreviewer) = 'O' Do FoxyPreviewer.App Endif With _Screen.oFoxyPreviewer .cTitle = Proper(Juststem(m.lcReport)) Report Form (m.lcReport) Preview Endwith EndifRegards,