Printing a Crystal Report directly to printer











up vote
0
down vote

favorite
1












I am creating a label printing function in a program that needs to create labels for the given information. I have created a label in Crystal Reports 9 but I'm having trouble printing it.



I don't want to save the label, I just want it to print directly after the system has created it.



Dim ap9 As craxdrt.Application
Dim rpt9 As craxdrt.Report
Dim dbt As craxdrt.DatabaseTable

Set ap9 = New craxdrt.Application
On Error GoTo errError2

Set iniFile = New CIniFile
On Error GoTo errError3

Set rpt9 = ap9.OpenReport(iniFile.pathReports & REPORT_LABEL_IN)
On Error GoTo errError4

For Each dbt In rpt9.Database.Tables
dbt.Location = iniFile.pathDbCosmet
If dbt.ConnectionProperties.count <= 5 Then
dbt.ConnectionProperties.Add "Database Password", iniFile.passwordCosmet
End If
Next

rpt9.RecordSelectionFormula = sFormula
rpt9.PrintOut False, CInt(txtPacksReceived.Text)


The following code allows me to select a printer



enter image description here



and after clicking 'Print' at that point I am shown another dialog



enter image description here



However, the code executes fine, there are no errors, but the print queue doesn't show any documents and the report doesn't print.



Is there some reason why I'm not able to print my labels?










share|improve this question




























    up vote
    0
    down vote

    favorite
    1












    I am creating a label printing function in a program that needs to create labels for the given information. I have created a label in Crystal Reports 9 but I'm having trouble printing it.



    I don't want to save the label, I just want it to print directly after the system has created it.



    Dim ap9 As craxdrt.Application
    Dim rpt9 As craxdrt.Report
    Dim dbt As craxdrt.DatabaseTable

    Set ap9 = New craxdrt.Application
    On Error GoTo errError2

    Set iniFile = New CIniFile
    On Error GoTo errError3

    Set rpt9 = ap9.OpenReport(iniFile.pathReports & REPORT_LABEL_IN)
    On Error GoTo errError4

    For Each dbt In rpt9.Database.Tables
    dbt.Location = iniFile.pathDbCosmet
    If dbt.ConnectionProperties.count <= 5 Then
    dbt.ConnectionProperties.Add "Database Password", iniFile.passwordCosmet
    End If
    Next

    rpt9.RecordSelectionFormula = sFormula
    rpt9.PrintOut False, CInt(txtPacksReceived.Text)


    The following code allows me to select a printer



    enter image description here



    and after clicking 'Print' at that point I am shown another dialog



    enter image description here



    However, the code executes fine, there are no errors, but the print queue doesn't show any documents and the report doesn't print.



    Is there some reason why I'm not able to print my labels?










    share|improve this question


























      up vote
      0
      down vote

      favorite
      1









      up vote
      0
      down vote

      favorite
      1






      1





      I am creating a label printing function in a program that needs to create labels for the given information. I have created a label in Crystal Reports 9 but I'm having trouble printing it.



      I don't want to save the label, I just want it to print directly after the system has created it.



      Dim ap9 As craxdrt.Application
      Dim rpt9 As craxdrt.Report
      Dim dbt As craxdrt.DatabaseTable

      Set ap9 = New craxdrt.Application
      On Error GoTo errError2

      Set iniFile = New CIniFile
      On Error GoTo errError3

      Set rpt9 = ap9.OpenReport(iniFile.pathReports & REPORT_LABEL_IN)
      On Error GoTo errError4

      For Each dbt In rpt9.Database.Tables
      dbt.Location = iniFile.pathDbCosmet
      If dbt.ConnectionProperties.count <= 5 Then
      dbt.ConnectionProperties.Add "Database Password", iniFile.passwordCosmet
      End If
      Next

      rpt9.RecordSelectionFormula = sFormula
      rpt9.PrintOut False, CInt(txtPacksReceived.Text)


      The following code allows me to select a printer



      enter image description here



      and after clicking 'Print' at that point I am shown another dialog



      enter image description here



      However, the code executes fine, there are no errors, but the print queue doesn't show any documents and the report doesn't print.



      Is there some reason why I'm not able to print my labels?










      share|improve this question















      I am creating a label printing function in a program that needs to create labels for the given information. I have created a label in Crystal Reports 9 but I'm having trouble printing it.



      I don't want to save the label, I just want it to print directly after the system has created it.



      Dim ap9 As craxdrt.Application
      Dim rpt9 As craxdrt.Report
      Dim dbt As craxdrt.DatabaseTable

      Set ap9 = New craxdrt.Application
      On Error GoTo errError2

      Set iniFile = New CIniFile
      On Error GoTo errError3

      Set rpt9 = ap9.OpenReport(iniFile.pathReports & REPORT_LABEL_IN)
      On Error GoTo errError4

      For Each dbt In rpt9.Database.Tables
      dbt.Location = iniFile.pathDbCosmet
      If dbt.ConnectionProperties.count <= 5 Then
      dbt.ConnectionProperties.Add "Database Password", iniFile.passwordCosmet
      End If
      Next

      rpt9.RecordSelectionFormula = sFormula
      rpt9.PrintOut False, CInt(txtPacksReceived.Text)


      The following code allows me to select a printer



      enter image description here



      and after clicking 'Print' at that point I am shown another dialog



      enter image description here



      However, the code executes fine, there are no errors, but the print queue doesn't show any documents and the report doesn't print.



      Is there some reason why I'm not able to print my labels?







      printing crystal-reports vb6






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 12 at 12:54

























      asked Nov 9 at 16:02









      David

      1,53721436




      1,53721436
























          2 Answers
          2






          active

          oldest

          votes

















          up vote
          0
          down vote



          accepted
          +50










          I've had problems with Zebra printers in the past that all turned out to be driver related. Have you uninstalled the printer driver and reinstalled it? Otherwise try unplugging and removing the device, plugging it into a different port and trying again?






          share|improve this answer




























            up vote
            0
            down vote













            Most likely your report doesn't contain any data - some logical error in selection/suppression formulas or similar.



            If you print to any other printer, does something print out? Tracing SQL (assuming your report is bound to SQL server), can you see issued query? Does it look correct?






            share|improve this answer























            • I modified the code so that it displays to a report viewer first and there was data on the report. It doesn't print to any printer, although when I set the first property of .PrintOut to True the window displayed to confirm the printer, page number etc but even after clicking "Print" it still did nothing.
              – David
              Nov 12 at 14:05










            • If you print directly from viewer (it should have print button), does it print? If you run your executable (or vb6) as administrator, does that change anything? We have seen experienced problems with specific printers (zebras are not the worst ones), but some standard printers usually work well. And - what is value of CInt(txtPacksReceived.Text)?
              – Arvo
              Nov 12 at 14:43










            • Running the .exe as administrator didn't change anything, nor did trying to print it from the viewer.
              – David
              Nov 12 at 14:51










            • Hmm, then this may be some Crystal Reports installation issue? (I suppose other programs, like Notepad, can print properly - if not, then it is more like WIndows problem.) We have used CR+VB6 combo maybe for 15 years, I have never seen such problem so far.
              – Arvo
              Nov 13 at 7:13










            • I did test a Word document to the regular printer and this didn't print. I removed the label printer, plugged it into a USB port and tried again and the labels printed okay, so I agree that it does seem like a problem with Windows and the USB drivers.
              – David
              Nov 13 at 9:14











            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53229262%2fprinting-a-crystal-report-directly-to-printer%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote



            accepted
            +50










            I've had problems with Zebra printers in the past that all turned out to be driver related. Have you uninstalled the printer driver and reinstalled it? Otherwise try unplugging and removing the device, plugging it into a different port and trying again?






            share|improve this answer

























              up vote
              0
              down vote



              accepted
              +50










              I've had problems with Zebra printers in the past that all turned out to be driver related. Have you uninstalled the printer driver and reinstalled it? Otherwise try unplugging and removing the device, plugging it into a different port and trying again?






              share|improve this answer























                up vote
                0
                down vote



                accepted
                +50







                up vote
                0
                down vote



                accepted
                +50




                +50




                I've had problems with Zebra printers in the past that all turned out to be driver related. Have you uninstalled the printer driver and reinstalled it? Otherwise try unplugging and removing the device, plugging it into a different port and trying again?






                share|improve this answer












                I've had problems with Zebra printers in the past that all turned out to be driver related. Have you uninstalled the printer driver and reinstalled it? Otherwise try unplugging and removing the device, plugging it into a different port and trying again?







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 19 at 9:24









                Harambe

                308117




                308117
























                    up vote
                    0
                    down vote













                    Most likely your report doesn't contain any data - some logical error in selection/suppression formulas or similar.



                    If you print to any other printer, does something print out? Tracing SQL (assuming your report is bound to SQL server), can you see issued query? Does it look correct?






                    share|improve this answer























                    • I modified the code so that it displays to a report viewer first and there was data on the report. It doesn't print to any printer, although when I set the first property of .PrintOut to True the window displayed to confirm the printer, page number etc but even after clicking "Print" it still did nothing.
                      – David
                      Nov 12 at 14:05










                    • If you print directly from viewer (it should have print button), does it print? If you run your executable (or vb6) as administrator, does that change anything? We have seen experienced problems with specific printers (zebras are not the worst ones), but some standard printers usually work well. And - what is value of CInt(txtPacksReceived.Text)?
                      – Arvo
                      Nov 12 at 14:43










                    • Running the .exe as administrator didn't change anything, nor did trying to print it from the viewer.
                      – David
                      Nov 12 at 14:51










                    • Hmm, then this may be some Crystal Reports installation issue? (I suppose other programs, like Notepad, can print properly - if not, then it is more like WIndows problem.) We have used CR+VB6 combo maybe for 15 years, I have never seen such problem so far.
                      – Arvo
                      Nov 13 at 7:13










                    • I did test a Word document to the regular printer and this didn't print. I removed the label printer, plugged it into a USB port and tried again and the labels printed okay, so I agree that it does seem like a problem with Windows and the USB drivers.
                      – David
                      Nov 13 at 9:14















                    up vote
                    0
                    down vote













                    Most likely your report doesn't contain any data - some logical error in selection/suppression formulas or similar.



                    If you print to any other printer, does something print out? Tracing SQL (assuming your report is bound to SQL server), can you see issued query? Does it look correct?






                    share|improve this answer























                    • I modified the code so that it displays to a report viewer first and there was data on the report. It doesn't print to any printer, although when I set the first property of .PrintOut to True the window displayed to confirm the printer, page number etc but even after clicking "Print" it still did nothing.
                      – David
                      Nov 12 at 14:05










                    • If you print directly from viewer (it should have print button), does it print? If you run your executable (or vb6) as administrator, does that change anything? We have seen experienced problems with specific printers (zebras are not the worst ones), but some standard printers usually work well. And - what is value of CInt(txtPacksReceived.Text)?
                      – Arvo
                      Nov 12 at 14:43










                    • Running the .exe as administrator didn't change anything, nor did trying to print it from the viewer.
                      – David
                      Nov 12 at 14:51










                    • Hmm, then this may be some Crystal Reports installation issue? (I suppose other programs, like Notepad, can print properly - if not, then it is more like WIndows problem.) We have used CR+VB6 combo maybe for 15 years, I have never seen such problem so far.
                      – Arvo
                      Nov 13 at 7:13










                    • I did test a Word document to the regular printer and this didn't print. I removed the label printer, plugged it into a USB port and tried again and the labels printed okay, so I agree that it does seem like a problem with Windows and the USB drivers.
                      – David
                      Nov 13 at 9:14













                    up vote
                    0
                    down vote










                    up vote
                    0
                    down vote









                    Most likely your report doesn't contain any data - some logical error in selection/suppression formulas or similar.



                    If you print to any other printer, does something print out? Tracing SQL (assuming your report is bound to SQL server), can you see issued query? Does it look correct?






                    share|improve this answer














                    Most likely your report doesn't contain any data - some logical error in selection/suppression formulas or similar.



                    If you print to any other printer, does something print out? Tracing SQL (assuming your report is bound to SQL server), can you see issued query? Does it look correct?







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Nov 12 at 14:44

























                    answered Nov 12 at 13:18









                    Arvo

                    7,68511926




                    7,68511926












                    • I modified the code so that it displays to a report viewer first and there was data on the report. It doesn't print to any printer, although when I set the first property of .PrintOut to True the window displayed to confirm the printer, page number etc but even after clicking "Print" it still did nothing.
                      – David
                      Nov 12 at 14:05










                    • If you print directly from viewer (it should have print button), does it print? If you run your executable (or vb6) as administrator, does that change anything? We have seen experienced problems with specific printers (zebras are not the worst ones), but some standard printers usually work well. And - what is value of CInt(txtPacksReceived.Text)?
                      – Arvo
                      Nov 12 at 14:43










                    • Running the .exe as administrator didn't change anything, nor did trying to print it from the viewer.
                      – David
                      Nov 12 at 14:51










                    • Hmm, then this may be some Crystal Reports installation issue? (I suppose other programs, like Notepad, can print properly - if not, then it is more like WIndows problem.) We have used CR+VB6 combo maybe for 15 years, I have never seen such problem so far.
                      – Arvo
                      Nov 13 at 7:13










                    • I did test a Word document to the regular printer and this didn't print. I removed the label printer, plugged it into a USB port and tried again and the labels printed okay, so I agree that it does seem like a problem with Windows and the USB drivers.
                      – David
                      Nov 13 at 9:14


















                    • I modified the code so that it displays to a report viewer first and there was data on the report. It doesn't print to any printer, although when I set the first property of .PrintOut to True the window displayed to confirm the printer, page number etc but even after clicking "Print" it still did nothing.
                      – David
                      Nov 12 at 14:05










                    • If you print directly from viewer (it should have print button), does it print? If you run your executable (or vb6) as administrator, does that change anything? We have seen experienced problems with specific printers (zebras are not the worst ones), but some standard printers usually work well. And - what is value of CInt(txtPacksReceived.Text)?
                      – Arvo
                      Nov 12 at 14:43










                    • Running the .exe as administrator didn't change anything, nor did trying to print it from the viewer.
                      – David
                      Nov 12 at 14:51










                    • Hmm, then this may be some Crystal Reports installation issue? (I suppose other programs, like Notepad, can print properly - if not, then it is more like WIndows problem.) We have used CR+VB6 combo maybe for 15 years, I have never seen such problem so far.
                      – Arvo
                      Nov 13 at 7:13










                    • I did test a Word document to the regular printer and this didn't print. I removed the label printer, plugged it into a USB port and tried again and the labels printed okay, so I agree that it does seem like a problem with Windows and the USB drivers.
                      – David
                      Nov 13 at 9:14
















                    I modified the code so that it displays to a report viewer first and there was data on the report. It doesn't print to any printer, although when I set the first property of .PrintOut to True the window displayed to confirm the printer, page number etc but even after clicking "Print" it still did nothing.
                    – David
                    Nov 12 at 14:05




                    I modified the code so that it displays to a report viewer first and there was data on the report. It doesn't print to any printer, although when I set the first property of .PrintOut to True the window displayed to confirm the printer, page number etc but even after clicking "Print" it still did nothing.
                    – David
                    Nov 12 at 14:05












                    If you print directly from viewer (it should have print button), does it print? If you run your executable (or vb6) as administrator, does that change anything? We have seen experienced problems with specific printers (zebras are not the worst ones), but some standard printers usually work well. And - what is value of CInt(txtPacksReceived.Text)?
                    – Arvo
                    Nov 12 at 14:43




                    If you print directly from viewer (it should have print button), does it print? If you run your executable (or vb6) as administrator, does that change anything? We have seen experienced problems with specific printers (zebras are not the worst ones), but some standard printers usually work well. And - what is value of CInt(txtPacksReceived.Text)?
                    – Arvo
                    Nov 12 at 14:43












                    Running the .exe as administrator didn't change anything, nor did trying to print it from the viewer.
                    – David
                    Nov 12 at 14:51




                    Running the .exe as administrator didn't change anything, nor did trying to print it from the viewer.
                    – David
                    Nov 12 at 14:51












                    Hmm, then this may be some Crystal Reports installation issue? (I suppose other programs, like Notepad, can print properly - if not, then it is more like WIndows problem.) We have used CR+VB6 combo maybe for 15 years, I have never seen such problem so far.
                    – Arvo
                    Nov 13 at 7:13




                    Hmm, then this may be some Crystal Reports installation issue? (I suppose other programs, like Notepad, can print properly - if not, then it is more like WIndows problem.) We have used CR+VB6 combo maybe for 15 years, I have never seen such problem so far.
                    – Arvo
                    Nov 13 at 7:13












                    I did test a Word document to the regular printer and this didn't print. I removed the label printer, plugged it into a USB port and tried again and the labels printed okay, so I agree that it does seem like a problem with Windows and the USB drivers.
                    – David
                    Nov 13 at 9:14




                    I did test a Word document to the regular printer and this didn't print. I removed the label printer, plugged it into a USB port and tried again and the labels printed okay, so I agree that it does seem like a problem with Windows and the USB drivers.
                    – David
                    Nov 13 at 9:14


















                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53229262%2fprinting-a-crystal-report-directly-to-printer%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    這個網誌中的熱門文章

                    Tangent Lines Diagram Along Smooth Curve

                    Yusuf al-Mu'taman ibn Hud

                    Zucchini