Link to home
Start Free TrialLog in
Avatar of superleo
superleo

asked on

Printer 2 reports in one procedure.

Dear all experts,

I would like to let user set the printer and print 2 reports when user press "Print" button.

The following is my code,

******************************************************
    If cbOT_Report.Value Then
      WriteTempOT
                 
      With crOT
        .ReportFileName = OTReport
        .ParameterFields(0) = ParaStr
        .Connect = ConnStr
        .SQLQuery = OTSQL
        .PrinterSelect
        .Destination = crptToPrinter

        .Action = 1
      End With
    End If
   
    If cbAllw_Report.Value Then
      WriteTempAllw
     
      With crAllw
        .ReportFileName = AllwReport
        .ParameterFields(0) = ParaStr
        .Connect = ConnStr
        .SQLQuery = AllwSQL
        .Destination = crptToPrinter
       
        .Action = 1
      End With
    End If
******************************************************

But is seem that just the first report will be printed.

Please to give me your kind advise.

Yours
superleo
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of superleo
superleo

ASKER

Thanks mlmcc

In fact we need not to care the value of cbAllw_Report.Value and cbOT_Report.Value because I sure that it fulfill the condition and both program segment are ran.

Anyway, normally the user use the same printer to print both report so I just let them to select the printer once.

Please kindly to give me your advise again, thank you.

superleo
CR has a nasty habit of keeping the printer name with the report.  If the user cannot access the printer or doesn't have a default printer set, the report may not be getting printed.

mlmcc
What does AllwSQL equal?

How is crAllw declared and is it properly opened?

mlmcc

Hello mlmcc,

I have try to add one more .PrinterSelect but it prompt the select printer dialog box twice.

I can view the report properly when I preview the both report so I think that the SQL query has no problem.

Thank you for your help, mlmcc.

superleo
Hello mlmcc,

I have try to add one more .PrinterSelect but it prompt the select printer dialog box twice.

I can view the report properly when I preview the both report so I think that the SQL query has no problem.

Thank you for your help, mlmcc.

superleo
Hello mlmcc,

It is no problem when I preview on both report. So, I think that the SQL query has no problem as well.

Thank you very much, mlmcc

superleo
As I said in my first comment, the code you have posted looks fine.

I have asked clarifying questions because I have seen instances where adding the query or setting a parameter as you are doing causes a report not to work.  Without providing the requested information I cannot try to solve your problem.

Where does this code reside?  Which print button are you referring to?

If you reversed to order of the printint does the second report print?

mlmcc

This question has been classified abandoned. I will make a recommendation to the moderators on its resolution in a week or two. I appreciate any comments that would help me to make a recommendation.


Unless it is clear to me that the question has been answered I will recommend delete. It is possible that a Grade less than A will be given if no expert makes a case for an A grade. It is assumed that any participant not responding to this request is no longer interested in its final disposition.


If the user does not know how to close the question, the options are here:
https://www.experts-exchange.com/help/closing.jsp

Pat K
EE Cleanup Volunteer
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: mlmcc {http:#7463546}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

mnye
EE Cleanup Volunteer