Results 1 to 31 of 31

Thread: vb6 + crystal report 8.5 printing problem

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2017
    Posts
    14

    Thumbs up vb6 + crystal report 8.5 printing problem

    am having problem using my app not printing.. when i click the print button it seems nothing is happening and no error is poping up..

    installed software:
    OS windows 10
    crystal report 8.5
    microsoft access from office 2013

    here is my code i made

    Code:
    'PRINT
        Case 11
        Select Case FormCategory
                Case "RawMaterials"
                    CrystalReport1.ReportFileName = App.Path & "\MATERIALS.rpt"
                    CrystalReport1.Connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Data.mdb" & ";Persist Security Info=False"
                    CrystalReport1.SQLQuery = "select * from Materials order by Code"
                    CrystalReport1.Action = 1
                    CrystalReport1.WindowState = crptMaximized
                    'CrystalReport1.PrinterSelect
                    CrystalReport1.Reset
                Case "Products"
                    If Form2.cmbCode.Text = "" Then
                        CrystalReport1.ReportFileName = App.Path & "\PRODUCTS.rpt"
                        CrystalReport1.Connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Data.mdb" & ";Persist Security Info=False"
                        CrystalReport1.SQLQuery = "select * from Products order by Code"
                        CrystalReport1.Action = 1
                        CrystalReport1.WindowState = crptMaximized
                        'CrystalReport1.PrinterSelect
                        CrystalReport1.Reset
                    Else
                        CrystalReport1.ReportFileName = App.Path & "\COMPONENTS.rpt"
                        CrystalReport1.Connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Data.mdb" & ";Persist Security Info=False"
                        'CrystalReport1.SQLQuery = "select * from Components where product_code = '" & Trim(Form2.cmbCode.Text) & "'"  'order by Material_Code"
                        CrystalReport1.SQLQuery = "select * from Components, Products, Materials " & _
                                                  "where Components.Code = Products.Code " & _
                                                  "AND Components.Material_Code = Materials.Code " & _
                                                  "AND product_code = '" & Trim(Form2.cmbCode.Text) & "' " & _
                                                  "ORDER BY RawMaterial_Index"
                        CrystalReport1.Action = 1
                        CrystalReport1.WindowState = crptMaximized
                        'CrystalReport1.PrinterSelect
                        CrystalReport1.Reset
                    End If
                
                Case Else
                    'MsgBox "Else"
        End Select
    thanks in advance to those who will help me

  2. #2

    Thread Starter
    New Member
    Join Date
    Sep 2017
    Posts
    14

    Re: vb6 + crystal report 8.5 printing problem

    bumps...

  3. #3
    PowerPoster ChrisE's Avatar
    Join Date
    Jun 2017
    Location
    Frankfurt
    Posts
    3,048

    Re: vb6 + crystal report 8.5 printing problem

    Hi ,

    isn't the Provider for Access 2013
    Code:
    Microsoft.ACE.OLEDB.12.0
    regards
    Chris
    to hunt a species to extinction is not logical !
    since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.

  4. #4
    Fanatic Member Spooman's Avatar
    Join Date
    Mar 2017
    Posts
    868

    Re: vb6 + crystal report 8.5 printing problem

    Freddy

    If Chris's idea doesn't do the trick, put a breakpoint here ..
    Code:
        Case 11
            Select Case FormCategory
                Case "RawMaterials"
                        ' 1
                Case "Products"
                    If Form2.cmbCode.Text = "" Then
                        ' 2
                    Else
                        ' 3
                    End If
                Case Else
                        ' 4
            End Select
    Which branch is entered?

    Spoo

  5. #5

    Thread Starter
    New Member
    Join Date
    Sep 2017
    Posts
    14

    Re: vb6 + crystal report 8.5 printing problem

    Quote Originally Posted by ChrisE View Post
    Hi ,

    isn't the Provider for Access 2013
    Code:
    Microsoft.ACE.OLEDB.12.0
    regards
    Chris
    after changing the provider i got runtime error 3706 which is wierd i have typed it correctly is there any point i need to insert?

    Quote Originally Posted by Spooman View Post
    Freddy

    If Chris's idea doesn't do the trick, put a breakpoint here ..
    Code:
        Case 11
            Select Case FormCategory
                Case "RawMaterials"
                        ' 1
                Case "Products"
                    If Form2.cmbCode.Text = "" Then
                        ' 2
                    Else
                        ' 3
                    End If
                Case Else
                        ' 4
            End Select
    Which branch is entered?

    Spoo
    what do you mean break point? and which branch?
    sorry am lost on what are you talking about

    fred

  6. #6
    PowerPoster ChrisE's Avatar
    Join Date
    Jun 2017
    Location
    Frankfurt
    Posts
    3,048

    Re: vb6 + crystal report 8.5 printing problem

    Hi,

    did you research the error?
    Code:
    after changing the provider i got runtime error 3706 which is wierd i have typed it correctly is there any point i need to insert?
    http://forums.devx.com/showthread.ph...ime-Error-3706

    regards
    Chris
    to hunt a species to extinction is not logical !
    since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.

  7. #7
    Fanatic Member Spooman's Avatar
    Join Date
    Mar 2017
    Posts
    868

    Re: vb6 + crystal report 8.5 printing problem

    Freddy

    what do you mean break point? and which branch?
    sorry am lost on what are you talking about
    OK, no probs .. let me explain.
    A break-point is a technique use for debugging purposes

    To initiate a break-point,
    • open you IDE .. the editor, where you created the code
    • go to the line in question
    • click in the "left margin"

    A "dot" appears in the margin, and the selected line is highlighted, as seen below
    Name:  breakpoint.png
Views: 4966
Size:  8.2 KB

    Now you can debug.
    1. Restart your app
    2. When the break-point is reached, the app will suspend at the line you selected
    3. Press the F8 key to step thru 1 line of code
    4. Press the F8 key again to step thru the next line, and so on.
    5. You can now see which branch is entered.


    Hope that helps.
    Give us a update.

    EDIT-1

    BTW, you have a lot of code in each branch
    My reason for asking which branch is entered is so we can focus on the code in said branch and hopefully come up with an answer to your question

    Spoo
    Last edited by Spooman; Sep 14th, 2017 at 08:37 AM.

  8. #8

    Thread Starter
    New Member
    Join Date
    Sep 2017
    Posts
    14

    Re: vb6 + crystal report 8.5 printing problem

    Quote Originally Posted by ChrisE View Post
    Hi,

    did you research the error?
    Code:
    after changing the provider i got runtime error 3706 which is wierd i have typed it correctly is there any point i need to insert?
    http://forums.devx.com/showthread.ph...ime-Error-3706

    regards
    Chris
    i have manage to get rid of the error 3706 but still same problem i cant get it to print
    i also tried using "Microsoft.ACE.OLEDB.15.0" still the result is same no response from my printer

    Quote Originally Posted by Spooman View Post
    Freddy



    OK, no probs .. let me explain.
    A break-point is a technique use for debugging purposes

    To initiate a break-point,
    • open you IDE .. the editor, where you created the code
    • go to the line in question
    • click in the "left margin"

    A "dot" appears in the margin, and the selected line is highlighted, as seen below
    Name:  breakpoint.png
Views: 4966
Size:  8.2 KB

    Now you can debug.
    1. Restart your app
    2. When the break-point is reached, the app will suspend at the line you selected
    3. Press the F8 key to step thru 1 line of code
    4. Press the F8 key again to step thru the next line, and so on.
    5. You can now see which branch is entered.


    Hope that helps.
    Give us a update.

    EDIT-1

    BTW, you have a lot of code in each branch
    My reason for asking which branch is entered is so we can focus on the code in said branch and hopefully come up with an answer to your question

    Spoo
    hi spoo
    yes i also did this one putting break points and run each and every comman using F8 but no errors comes up am really getting frustrated with this

    br
    fred

  9. #9
    PowerPoster ChrisE's Avatar
    Join Date
    Jun 2017
    Location
    Frankfurt
    Posts
    3,048

    Re: vb6 + crystal report 8.5 printing problem

    Hi Freddy,

    please don't send me PM with the ofer to send me your code for checking.
    As I said I don't use CR, Post your Code here, you will have more luck with more people
    seeing what you are doing.

    here another Link, showing step by step how to select a Provider (ACE.OLE; SQL-Server etc..)
    http://vb.net-informations.com/cryst...ep_by_step.htm

    regards
    Chris
    to hunt a species to extinction is not logical !
    since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.

  10. #10
    Fanatic Member Spooman's Avatar
    Join Date
    Mar 2017
    Posts
    868

    Re: vb6 + crystal report 8.5 printing problem

    Freddy

    Ditto what Chris said re PM's and CR and posting here.

    Did you try my break-point suggestion?

    Spoo

  11. #11

    Thread Starter
    New Member
    Join Date
    Sep 2017
    Posts
    14

    Re: vb6 + crystal report 8.5 printing problem

    Quote Originally Posted by Spooman View Post
    Freddy

    Ditto what Chris said re PM's and CR and posting here.

    Did you try my break-point suggestion?

    Spoo
    yes i did and apparently no error pops up.. there is no response from my printer

    here is my code in module
    Code:
    Public Sub DB_Connect()
    Set DB_Connection = New ADODB.Connection
    DB_Connection_String = "Provider=Microsoft.ACE.OLEDB.15.0;Data Source=" & App.Path & "\Andalucia_Data.mdb" & ";Persist Security Info=False"
    DB_Connection.Open DB_Connection_String
    End Sub
    ---------------------------------------------------------------------------------------------------------------------------
    Select Case FormCategory
        Case "RawMaterials"
            Call SAVE_TO_RAW_MATERIALS("RawMaterials_Temp")
            Call UPDATE_RAW_MATERIALS_ON_PRODUCT_COMPONENTS(Form1, "Product_Components_Temp")
            Call RECOMPUTE_PRODUCTS_ON_PRODUCT_COMPONENTS(Form1, "Product_Components_Temp", "Products_Temp", "RawMaterials_Temp")
            
            MDIForm1.CrystalReport1.ReportFileName = App.Path & "\PRODUCT_COST_VARIATION.rpt"
            MDIForm1.CrystalReport1.Connect = "Provider=Microsoft.ACE.OLEDB.15.0;Data Source=" & App.Path & "\Data.mdb" & ";Persist Security Info=False"
            MDIForm1.CrystalReport1.SQLQuery = "select * from Products, Products_Temp " & _
                                      "where Products.Code = Products_Temp.Code " & _
                                      "and ((Products.Price_Kilo <> Products_Temp.Price_Kilo) OR " & _
                                      "(Products.Price_Liter <> Products_Temp.Price_Liter) OR " & _
                                      "(Products.Price_Gallon <> Products_Temp.Price_Gallon)) " & _
                                      "ORDER BY Products.Code"
            MDIForm1.CrystalReport1.Action = 1
            MDIForm1.CrystalReport1.WindowState = crptMaximized
            MDIForm1.CrystalReport1.Reset
    and here is the code i made in MDIForm1

    Code:
    'PRINT
        Case 11
        Select Case FormCategory
                Case "RawMaterials"
                    CrystalReport1.ReportFileName = App.Path & "\RAWMATERIALS.rpt"
                    CrystalReport1.Connect = "Provider=Microsoft.ACE.OLEDB.15.0;Data Source=" & App.Path & "\Data.mdb" & ";Persist Security Info=False"
                    CrystalReport1.SQLQuery = "select * from RawMaterials order by Code"
                    CrystalReport1.Action = 1
                    CrystalReport1.WindowState = crptMaximized
                    'CrystalReport1.PrinterSelect
                    CrystalReport1.Reset
                Case "Products"
                    If Form2.cmbCode.Text = "" Then
                        CrystalReport1.ReportFileName = App.Path & "\PRODUCTS.rpt"
                        CrystalReport1.Connect = "Provider=Microsoft.ACE.OLEDB.15.0;Data Source=" & App.Path & "\Data.mdb" & ";Persist Security Info=False"
                        CrystalReport1.SQLQuery = "select * from Products order by Code"
                        CrystalReport1.Action = 1
                        CrystalReport1.WindowState = crptMaximized
                        'CrystalReport1.PrinterSelect
                        CrystalReport1.Reset
                    Else
                        CrystalReport1.ReportFileName = App.Path & "\PRODUCT_COMPONENTS.rpt"
                        CrystalReport1.Connect = "Provider=Microsoft.ACE.OLEDB.15.0;Data Source=" & App.Path & "\Data.mdb" & ";Persist Security Info=False"
                        'CrystalReport1.SQLQuery = "select * from Product_Components where product_code = '" & Trim(Form2.cmbCode.Text) & "'"  'order by RawMaterial_Code"
                        CrystalReport1.SQLQuery = "select * from Product_Components, Products, RawMaterials " & _
                                                  "where Product_Components.Product_Code = Products.Code " & _
                                                  "AND Product_Components.RawMaterial_Code = RawMaterials.Code " & _
                                                  "AND product_code = '" & Trim(Form2.cmbCode.Text) & "' " & _
                                                  "ORDER BY RawMaterial_Index"
                        CrystalReport1.Action = 1
                        CrystalReport1.WindowState = crptMaximized
                        'CrystalReport1.PrinterSelect
                        CrystalReport1.Reset
                    End If
    ps:
    i have already used Provider=Microsoft.ACE.OLEDB.12.0 but still no luck

    br
    fred

  12. #12
    Fanatic Member Spooman's Avatar
    Join Date
    Mar 2017
    Posts
    868

    Re: vb6 + crystal report 8.5 printing problem

    Quote Originally Posted by freddy3k View Post
    yes i did and apparently no error pops up.. there is no response from my printer
    OK, but that's not quite what I was trying to drill down to.
    I'm trying to isolate which branch is entered, thereby enabling someone who works with CR to possibly spot a deficiency.

    So again ...
    .. which of the 4 branches in MDIForm1 is entered?

    EDIT-1

    By deficiency, I was thinking more along the lines of potentially "missing" code (as opposed to "error-causing" code). If we know the "trail" as you progress through your code, the solution may become evident.

    BTW, have you written other code that successfully produced a CR print-out?

    Spoo
    Last edited by Spooman; Sep 15th, 2017 at 08:22 AM.

  13. #13

    Thread Starter
    New Member
    Join Date
    Sep 2017
    Posts
    14

    Re: vb6 + crystal report 8.5 printing problem

    Quote Originally Posted by Spooman View Post
    OK, but that's not quite what I was trying to drill down to.
    I'm trying to isolate which branch is entered, thereby enabling someone who works with CR to possibly spot a deficiency.

    So again ...
    .. which of the 4 branches in MDIForm1 is entered?

    Spoo
    the first one which is RawMaterials still all follows then still no response

    this is really weird... am hopping there is an error pop up so i can trace but still non..



    br
    fred

  14. #14
    Fanatic Member Spooman's Avatar
    Join Date
    Mar 2017
    Posts
    868

    Re: vb6 + crystal report 8.5 printing problem

    Freddy

    am hopping there is an error pop up so i can trace but still non.
    As I mentioned in my EDIT in post #12, it appears then that the issue is "missing" code.
    • Have you written code in another app that successfully produced a CR print-out?
    • If not, then we'll need to wait for someone who is familiar with Crystal Reports.


    Spoo

  15. #15

    Thread Starter
    New Member
    Join Date
    Sep 2017
    Posts
    14

    Re: vb6 + crystal report 8.5 printing problem

    Quote Originally Posted by Spooman View Post
    Freddy


    As I mentioned in my EDIT in post #12, it appears then that the issue is "missing" code.
    • Have you written code in another app that successfully produced a CR print-out?
    • If not, then we'll need to wait for someone who is familiar with Crystal Reports.


    Spoo
    yes i did wrote from scratch again with only 1 branch and it work printing but when i try putting the other branch there it goes again not printing..

    gezz this is really frustrating

  16. #16
    Fanatic Member Spooman's Avatar
    Join Date
    Mar 2017
    Posts
    868

    Re: vb6 + crystal report 8.5 printing problem

    Freddy

    I did an Advanced search of crystal in VB forums .. here are a few results:

    http://www.vbforums.com/showthread.p...hlight=crystal
    http://www.vbforums.com/showthread.p...hlight=crystal
    http://www.vbforums.com/showthread.p...hlight=crystal
    http://www.vbforums.com/showthread.p...hlight=crystal

    Regarding the last thread, check out westconn1's post #4 and subsequent posts.

    There are tons of other ones, too.

    Spoo

  17. #17

    Thread Starter
    New Member
    Join Date
    Sep 2017
    Posts
    14

    Re: vb6 + crystal report 8.5 printing problem

    Quote Originally Posted by Spooman View Post
    Freddy

    I did an Advanced search of crystal in VB forums .. here are a few results:

    http://www.vbforums.com/showthread.p...hlight=crystal
    http://www.vbforums.com/showthread.p...hlight=crystal
    http://www.vbforums.com/showthread.p...hlight=crystal
    http://www.vbforums.com/showthread.p...hlight=crystal

    Regarding the last thread, check out westconn1's post #4 and subsequent posts.

    There are tons of other ones, too.

    Spoo
    westconn1 post is about print preview which i didn't implement

    i feel something is missing.. cause my apps work on XP with CR8.5 + office 2007 and 2003 i just cant figure it out..

    the hell with xp gezzz...

  18. #18
    PowerPoster ChrisE's Avatar
    Join Date
    Jun 2017
    Location
    Frankfurt
    Posts
    3,048

    Re: vb6 + crystal report 8.5 printing problem

    Hi,

    could you Post the complete Select Case
    in Post#11 I don't see Case Else and no End Select

    regards
    Chris
    to hunt a species to extinction is not logical !
    since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.

  19. #19

    Thread Starter
    New Member
    Join Date
    Sep 2017
    Posts
    14

    Re: vb6 + crystal report 8.5 printing problem

    Quote Originally Posted by ChrisE View Post
    Hi,

    could you Post the complete Select Case
    in Post#11 I don't see Case Else and no End Select

    regards
    Chris
    Code:
    'PRINT
        Case 11
        Select Case FormCategory
                Case "RawMaterials"
                    CrystalReport1.ReportFileName = App.Path & "\RAWMATERIALS.rpt"
                    CrystalReport1.Connect = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & App.Path & "\Data.mdb" & ";Persist Security Info=False"
                    CrystalReport1.SQLQuery = "select * from RawMaterials order by Code"
                    CrystalReport1.Action = 1
                    CrystalReport1.WindowState = crptMaximized
                    'CrystalReport1.PrinterSelect
                    CrystalReport1.Reset
                Case "Products"
                    If Form2.cmbCode.Text = "" Then
                        CrystalReport1.ReportFileName = App.Path & "\PRODUCTS.rpt"
                        CrystalReport1.Connect = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & App.Path & "\Data.mdb" & ";Persist Security Info=False"
                        CrystalReport1.SQLQuery = "select * from Products order by Code"
                        CrystalReport1.Action = 1
                        CrystalReport1.WindowState = crptMaximized
                        'CrystalReport1.PrinterSelect
                        CrystalReport1.Reset
                    Else
                        CrystalReport1.ReportFileName = App.Path & "\PRODUCT_COMPONENTS.rpt"
                        CrystalReport1.Connect = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & App.Path & "\Data.mdb" & ";Persist Security Info=False"
                        'CrystalReport1.SQLQuery = "select * from Product_Components where product_code = '" & Trim(Form2.cmbCode.Text) & "'"  'order by RawMaterial_Code"
                        CrystalReport1.SQLQuery = "select * from Product_Components, Products, RawMaterials " & _
                                                  "where Product_Components.Product_Code = Products.Code " & _
                                                  "AND Product_Components.RawMaterial_Code = RawMaterials.Code " & _
                                                  "AND product_code = '" & Trim(Form2.cmbCode.Text) & "' " & _
                                                  "ORDER BY RawMaterial_Index"
                        CrystalReport1.Action = 1
                        CrystalReport1.WindowState = crptMaximized
                        'CrystalReport1.PrinterSelect
                        CrystalReport1.Reset
                    End If
                
                Case Else
                    'MsgBox "Else"
        End Select
    here is it....

  20. #20
    Fanatic Member Spooman's Avatar
    Join Date
    Mar 2017
    Posts
    868

    Re: vb6 + crystal report 8.5 printing problem

    Freddy

    Fair points.
    But this ..

    .. cause my apps work on XP with CR8.5 + office 2007 and 2003
    .. IS informative.

    Two thoughts.
    1. Follow Chris's post #18 suggestion
    2. Can you still produce the printout on your XP box? If so ..
      • Try the debugging process I described earlier, adding a break point and stepping through your code line by line.
      • Tell us which line of code triggers the printing process


    Spoo

  21. #21
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: vb6 + crystal report 8.5 printing problem

    you have a connection and a sql query, so it should take almost nothing to open a recordset to test if any records are returned

    i am sure CR should be able to display on the screen as well as printing, so you should be able to see if some record is displayed, just not printing

    check what your windows default printer is, in case it is something windows 10 in its infinite wisdom think you should print to, but does not exist, check in code (or other application properties) as to what printer should be receiving the printout from CR

    from experts exchange https://www.experts-exchange.com/que...l-Reports.html
    Crystal is highly dependent on the windows default printer. When you design a report, unless you want to design it against the default printer, you need to specify the printer in File|Page Setup within Crystal Reports.
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  22. #22

    Thread Starter
    New Member
    Join Date
    Sep 2017
    Posts
    14

    Re: vb6 + crystal report 8.5 printing problem

    Quote Originally Posted by Spooman View Post
    Freddy

    Fair points.
    But this ..



    .. IS informative.

    Two thoughts.
    1. Follow Chris's post #18 suggestion
    2. Can you still produce the printout on your XP box? If so ..
      • Try the debugging process I described earlier, adding a break point and stepping through your code line by line.
      • Tell us which line of code triggers the printing process


    Spoo
    i think i found my problem cause when i re-write the codes remove the unnecessary branch and just focus on printing i found out that msado25.tlb and Crystl32.OCX is not communicating with the sql database and when i check those ocx and tlb it was not not registered
    and when i try to register it say's "msado25.tlb failed to register"

    i already tried installing MDAC_TYP.EXE on win10 64bit but still same problem but on xp it was successfully registered thats the only difference i found between xp and win10

    FYI
    i already search the net and google it about "msado25.tlb failed to register"

    TIA



    Quote Originally Posted by westconn1 View Post
    you have a connection and a sql query, so it should take almost nothing to open a recordset to test if any records are returned

    i am sure CR should be able to display on the screen as well as printing, so you should be able to see if some record is displayed, just not printing

    check what your windows default printer is, in case it is something windows 10 in its infinite wisdom think you should print to, but does not exist, check in code (or other application properties) as to what printer should be receiving the printout from CR

    from experts exchange https://www.experts-exchange.com/que...l-Reports.html
    i tried printing direct through the CR apps with my .rpt files and it was successfully printing out in my printer problem is that the i app i made is not printing it might a problem communicating with some of my DLL's and OCX's.. i cant figure it out which one is not working properly

    TIA

    fred

  23. #23
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: vb6 + crystal report 8.5 printing problem

    i already tried installing MDAC_TYP.EXE on win10 64bit but still same problem
    in windows 10 you must use elevated permissions to register dlls etc, run as administrator, this applies even if you are logged in as an administrator user, else the registration will fail without notice
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  24. #24

    Thread Starter
    New Member
    Join Date
    Sep 2017
    Posts
    14

    Re: vb6 + crystal report 8.5 printing problem

    Quote Originally Posted by westconn1 View Post
    in windows 10 you must use elevated permissions to register dlls etc, run as administrator, this applies even if you are logged in as an administrator user, else the registration will fail without notice
    yes i did but same i cant register my tlb etc etc etc..

  25. #25
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: vb6 + crystal report 8.5 printing problem

    i doubt anyone can help you, as it appears to be a system problem

    have a look at using regfree com
    http://www.vbforums.com/showthread.p...rectCOM-Helper

    or SxS, there is a new tutorial for this, very recently, in this forum

    see if either of these methods can work for you
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  26. #26
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,253

    Re: vb6 + crystal report 8.5 printing problem

    I imagine you've lost quite a bit of time in trying to make that "monster of a dependency" (Crystal) work on Win10...

    Did you consider switching to (easier to deploy) alternatives already?
    It might seem a bit of work as well, but this is productive "happy work" with immediate (encouraging) results,
    until the old Crystal-Layout is re-incarnated, based on the new tool.

    No matter what you choose, you will be busy perhaps for a week at most - whereas
    with your current Crystal-problem the whole thing could be a "never ending story".

    The least problems with "Printing" are caused by direct rendering into PDF-Files (when the tool in
    question is not depending on any preinstalled Printers or Printer-Drivers) - it's just a file which
    you generate (with the help of a Dll or two) - and the User is then responsible to Print-Out
    that PDF-File (using the default-Viewer which you might shell for him, with any Printer he chooses there).

    Here's an example for that approach, which works well for me since years:
    http://www.vbforums.com/showthread.p...rawingRoutine)
    (the vbRichClient-Binaries, a set of 3 Dlls, are the only involved dependencies there - and you can ship and load them regfree with your App later on).

    Olaf

  27. #27
    PowerPoster ChrisE's Avatar
    Join Date
    Jun 2017
    Location
    Frankfurt
    Posts
    3,048

    Re: vb6 + crystal report 8.5 printing problem

    Quote Originally Posted by freddy3k View Post
    i think i found my problem cause when i re-write the codes remove the unnecessary branch and just focus on printing i found out that msado25.tlb and Crystl32.OCX is not communicating with the sql database and when i check those ocx and tlb it was not not registered
    and when i try to register it say's "msado25.tlb failed to register"

    i already tried installing MDAC_TYP.EXE on win10 64bit but still same problem but on xp it was successfully registered thats the only difference i found between xp and win10

    FYI
    i already search the net and google it about "msado25.tlb failed to register"

    TIA





    i tried printing direct through the CR apps with my .rpt files and it was successfully printing out in my printer problem is that the i app i made is not printing it might a problem communicating with some of my DLL's and OCX's.. i cant figure it out which one is not working properly

    TIA

    fred
    Hi Freddy,
    I don't know how many hours you have spent on this CR .

    have you ever tried the Datareport ?

    here a sample with No Dataenv.

    you pass your SQL and Print.. that's it
    or use the PDF-Creator

    Code:
    Private Sub cmdPrint_Click()
    Dim adoRS As ADODB.Recordset
    Dim strSQL As String
    Dim strWhere As String
    Dim strOrderBy As String
    
    If MSFlexGrid1.Row = 0 Then
    cmdPrint.Enabled = False
                Exit Sub
             End If
    strSQL = "SELECT tbl_Jahr.Ja_JahrNr, "
    strSQL = strSQL & "tbl_Betreiber.BE_Name , "
    strSQL = strSQL & "tbl_Betreiber.BE_Strasse , "
    strSQL = strSQL & "tbl_Betreiber.BE_PLZ ,"
    strSQL = strSQL & "tbl_Betreiber.BE_Ort ,  "
    strSQL = strSQL & "tbl_KontrolleTrinkwasser.TR_Firma , "
    strSQL = strSQL & "tbl_WartungBeet.PF_Firma , "
    strSQL = strSQL & "Kategorien.Kategoriename, "
    strSQL = strSQL & "tbl_Jahr.Ja_JahrNr , "
    strSQL = strSQL & "tbl_Eigenkontrolle.E_Datum, "
    strSQL = strSQL & "tbl_Eigenkontrolle.E_KW , "
    strSQL = strSQL & "tbl_Eigenkontrolle.E_KammerText, "
    strSQL = strSQL & "tbl_Eigenkontrolle.E_BeschickungText , "
    strSQL = strSQL & "tbl_Eigenkontrolle.E_WasserpfText ,"
    strSQL = strSQL & "tbl_Eigenkontrolle.E_LueckenpfText , "
    strSQL = strSQL & "tbl_Eigenkontrolle.E_UnkrautText , "
    strSQL = strSQL & "tbl_Eigenkontrolle.E_WasserklarText , "
    strSQL = strSQL & "tbl_Eigenkontrolle.E_Bemerkung "
    strSQL = strSQL & "FROM tbl_WartungBeet INNER JOIN (tbl_KontrolleTrinkwasser INNER JOIN "
    strSQL = strSQL & "((tbl_Betreiber INNER JOIN tbl_Jahr ON tbl_Betreiber.BE_ID = tbl_Jahr.Be_ID) "
    strSQL = strSQL & "INNER JOIN (tbl_Eigenkontrolle INNER JOIN Kategorien ON "
    strSQL = strSQL & "tbl_Eigenkontrolle.KategorieNr = Kategorien.KategorieNr) ON "
    strSQL = strSQL & "tbl_Jahr.Ja_ID = tbl_Eigenkontrolle.Ja_ID) ON "
    strSQL = strSQL & "tbl_KontrolleTrinkwasser.TR_ID = tbl_Jahr.TR_Kontrolle) ON "
    strSQL = strSQL & "tbl_WartungBeet.PF_ID = tbl_Jahr.PF_Kontrolle "
    
    strWhere = strWhere & "tbl_Jahr.Ja_JahrNr= '" & txtFirma & "'"
    strOrderBy = strOrderBy & "tbl_Eigenkontrolle.E_Datum "
    strSQL = strSQL & " WHERE " & strWhere & " Order BY " & strOrderBy
    
    Set adoRS = cnBeet.Execute(strSQL)
    With DataReport1
        .DataMember = vbNullString 'vbNullString = dynamisch! / ohne DataEnvironment
        .Orientation = rptOrientLandscape 'muss gesetzt sein Hoch oder Querformat!
        Set .DataSource = adoRS
        .Caption = "Protokoll Jahr (Betriebstagebuch)"
       .Title = adoRS.Fields(1).Value & " für das Jahr : " & adoRS.Fields(0)
    'Header:
        With .Sections("Bereich4").Controls
        .Item("BezJahr").Caption = adoRS.Fields(0).Value
        .Item("BezBetreiber").Caption = adoRS.Fields(1).Value
        .Item("BezStrasse").Caption = adoRS.Fields(2).Value
        .Item("BezPlz").Caption = adoRS.Fields(3).Value
        .Item("BezOrt").Caption = adoRS.Fields(4).Value
        .Item("BezTrinkwasser").Caption = adoRS.Fields(5).Value
        .Item("BezBeet").Caption = adoRS.Fields(6).Value
          End With
    'Detail:
            With .Sections("Bereich1").Controls
            .Item("txtDatum").DataField = adoRS.Fields(9).Name
            .Item("txtKW").DataField = adoRS.Fields(10).Name
            .Item("txtKat").DataField = adoRS.Fields(7).Name
            .Item("txtKammer").DataField = adoRS.Fields(11).Name
            .Item("txtBeschickung").DataField = adoRS.Fields(12).Name
            .Item("txtWasserpf").DataField = adoRS.Fields(13).Name
            .Item("txtLuecken").DataField = adoRS.Fields(14).Name
            .Item("txtUnkraut").DataField = adoRS.Fields(15).Name
            .Item("txtWasserklar").DataField = adoRS.Fields(16).Name
            .Item("txtBemerkung").DataField = adoRS.Fields(17).Name
        End With
    .Show ' show report
    'or:
    'if PDF-Creator is installed send it there
    '.PrintReport
    End With
    End Sub

    regards Chris
    to hunt a species to extinction is not logical !
    since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.

  28. #28
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: vb6 + crystal report 8.5 printing problem

    when i did report forms previously i used the printer object, with option to do the same printout to a picturebox as a preview if required
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  29. #29

    Thread Starter
    New Member
    Join Date
    Sep 2017
    Posts
    14

    Re: vb6 + crystal report 8.5 printing problem

    Quote Originally Posted by ChrisE View Post
    Hi Freddy,
    I don't know how many hours you have spent on this CR .

    have you ever tried the Datareport ?

    here a sample with No Dataenv.

    you pass your SQL and Print.. that's it
    or use the PDF-Creator

    Code:
    Private Sub cmdPrint_Click()
    Dim adoRS As ADODB.Recordset
    Dim strSQL As String
    Dim strWhere As String
    Dim strOrderBy As String
    
    If MSFlexGrid1.Row = 0 Then
    cmdPrint.Enabled = False
                Exit Sub
             End If
    strSQL = "SELECT tbl_Jahr.Ja_JahrNr, "
    strSQL = strSQL & "tbl_Betreiber.BE_Name , "
    strSQL = strSQL & "tbl_Betreiber.BE_Strasse , "
    strSQL = strSQL & "tbl_Betreiber.BE_PLZ ,"
    strSQL = strSQL & "tbl_Betreiber.BE_Ort ,  "
    strSQL = strSQL & "tbl_KontrolleTrinkwasser.TR_Firma , "
    strSQL = strSQL & "tbl_WartungBeet.PF_Firma , "
    strSQL = strSQL & "Kategorien.Kategoriename, "
    strSQL = strSQL & "tbl_Jahr.Ja_JahrNr , "
    strSQL = strSQL & "tbl_Eigenkontrolle.E_Datum, "
    strSQL = strSQL & "tbl_Eigenkontrolle.E_KW , "
    strSQL = strSQL & "tbl_Eigenkontrolle.E_KammerText, "
    strSQL = strSQL & "tbl_Eigenkontrolle.E_BeschickungText , "
    strSQL = strSQL & "tbl_Eigenkontrolle.E_WasserpfText ,"
    strSQL = strSQL & "tbl_Eigenkontrolle.E_LueckenpfText , "
    strSQL = strSQL & "tbl_Eigenkontrolle.E_UnkrautText , "
    strSQL = strSQL & "tbl_Eigenkontrolle.E_WasserklarText , "
    strSQL = strSQL & "tbl_Eigenkontrolle.E_Bemerkung "
    strSQL = strSQL & "FROM tbl_WartungBeet INNER JOIN (tbl_KontrolleTrinkwasser INNER JOIN "
    strSQL = strSQL & "((tbl_Betreiber INNER JOIN tbl_Jahr ON tbl_Betreiber.BE_ID = tbl_Jahr.Be_ID) "
    strSQL = strSQL & "INNER JOIN (tbl_Eigenkontrolle INNER JOIN Kategorien ON "
    strSQL = strSQL & "tbl_Eigenkontrolle.KategorieNr = Kategorien.KategorieNr) ON "
    strSQL = strSQL & "tbl_Jahr.Ja_ID = tbl_Eigenkontrolle.Ja_ID) ON "
    strSQL = strSQL & "tbl_KontrolleTrinkwasser.TR_ID = tbl_Jahr.TR_Kontrolle) ON "
    strSQL = strSQL & "tbl_WartungBeet.PF_ID = tbl_Jahr.PF_Kontrolle "
    
    strWhere = strWhere & "tbl_Jahr.Ja_JahrNr= '" & txtFirma & "'"
    strOrderBy = strOrderBy & "tbl_Eigenkontrolle.E_Datum "
    strSQL = strSQL & " WHERE " & strWhere & " Order BY " & strOrderBy
    
    Set adoRS = cnBeet.Execute(strSQL)
    With DataReport1
        .DataMember = vbNullString 'vbNullString = dynamisch! / ohne DataEnvironment
        .Orientation = rptOrientLandscape 'muss gesetzt sein Hoch oder Querformat!
        Set .DataSource = adoRS
        .Caption = "Protokoll Jahr (Betriebstagebuch)"
       .Title = adoRS.Fields(1).Value & " für das Jahr : " & adoRS.Fields(0)
    'Header:
        With .Sections("Bereich4").Controls
        .Item("BezJahr").Caption = adoRS.Fields(0).Value
        .Item("BezBetreiber").Caption = adoRS.Fields(1).Value
        .Item("BezStrasse").Caption = adoRS.Fields(2).Value
        .Item("BezPlz").Caption = adoRS.Fields(3).Value
        .Item("BezOrt").Caption = adoRS.Fields(4).Value
        .Item("BezTrinkwasser").Caption = adoRS.Fields(5).Value
        .Item("BezBeet").Caption = adoRS.Fields(6).Value
          End With
    'Detail:
            With .Sections("Bereich1").Controls
            .Item("txtDatum").DataField = adoRS.Fields(9).Name
            .Item("txtKW").DataField = adoRS.Fields(10).Name
            .Item("txtKat").DataField = adoRS.Fields(7).Name
            .Item("txtKammer").DataField = adoRS.Fields(11).Name
            .Item("txtBeschickung").DataField = adoRS.Fields(12).Name
            .Item("txtWasserpf").DataField = adoRS.Fields(13).Name
            .Item("txtLuecken").DataField = adoRS.Fields(14).Name
            .Item("txtUnkraut").DataField = adoRS.Fields(15).Name
            .Item("txtWasserklar").DataField = adoRS.Fields(16).Name
            .Item("txtBemerkung").DataField = adoRS.Fields(17).Name
        End With
    .Show ' show report
    'or:
    'if PDF-Creator is installed send it there
    '.PrintReport
    End With
    End Sub

    regards Chris
    am sorry but how can i insert this if i cant understand a word what that means? please do english
    TIA

    Quote Originally Posted by westconn1 View Post
    when i did report forms previously i used the printer object, with option to do the same printout to a picturebox as a preview if required
    can you point me out where exactly should i do this?

    TIA

  30. #30
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: vb6 + crystal report 8.5 printing problem

    can you point me out where exactly should i do this?
    probably in a separate sub, which you call when you want to produce a printout
    when you use the printer object you have to code everything yourself, position the text and graphics on the page, draw any lines where you want them, scale everything to fit, so it can involve quite a lot of code, but you have full control over which printer you use and all the printer properties, you can save the printer and properties used to a table in the database for default future use
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  31. #31
    PowerPoster ChrisE's Avatar
    Join Date
    Jun 2017
    Location
    Frankfurt
    Posts
    3,048

    Re: vb6 + crystal report 8.5 printing problem

    Hi Freddy,

    here a sample with the Northw. Database.
    or take a look at what westconn1 said ....
    when you use the printer object you have to code everything yourself, position the text and graphics on the page, draw any lines where you want them, scale everything to fit, so it can involve quite a lot of code, but you have full control over which printer you use and all the printer properties, you can save the printer and properties used to a table in the database for default future use

    here a smaller sample with DataReport

    Code:
    Option Explicit
    Dim adoConnection As ADODB.Connection
    
    Public Function openTheDatabase() As Boolean
    '-- DB open
    Dim sConnectionString As String
    On Error GoTo dbError
    '-- New connection --
    Set adoConnection = New ADODB.Connection
    sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" _
                     & "Data Source=" & App.Path & "\Northwind.mdb"
    adoConnection.Open sConnectionString
    openTheDatabase = True
    Exit Function
    dbError:
    MsgBox (Err.Description)
    openTheDatabase = False
    End Function
    
    'cmdVer is a Commandbutton
    Private Sub cmdVer_Click()
    Dim adoRS As ADODB.Recordset
    Dim strSql As String
    Dim strWhere As String
    
    strSql = "SELECT Products.ProductID, " 'ProductID                = Value (0)
    strSql = strSql & "Products.ProductName, " 'ProductName          = Value (1)
    strSql = strSql & "Categories.CategoryName " 'Kategoriename    = Value (2)
    strSql = strSql & "FROM Categories RIGHT JOIN "
    strSql = strSql & "Products ON Categories.CategoryID= "
    strSql = strSql & "Products.CategoryID "
    
    
    Set adoRS = adoConnection.Execute(strSql)
    
    With DataReport1
        .DataMember = vbNullString
        Set .DataSource = adoRS
        .Caption = "Productreport"
    'Detail:
        With .Sections("Bereich1").Controls
            .Item("rptArtNr").DataField = adoRS.Fields(0).Name
            .Item("rptArtName").DataField = adoRS.Fields(1).Name
            .Item("rptArtKat").DataField = adoRS.Fields(2).Name
        End With
    'Header
        With .Sections("Bereich2").Controls
        .Item("Be1").Caption = adoRS.Fields(2).Value
        End With
        .Show
        '.PrintReport
    End With
    Set adoRS = Nothing
    End Sub
    
    Private Sub Form_Load()
        If (Not openTheDatabase()) Then
        MsgBox "no Database !"
        Exit Sub
    End If
    End Sub

    regards
    Chris
    to hunt a species to extinction is not logical !
    since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width