Results 1 to 14 of 14

Thread: [RESOLVED] Crystal Report viewing Plss. help

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2006
    Posts
    208

    Resolved [RESOLVED] Crystal Report viewing Plss. help

    i created a common form that will be called by any form
    within my project, i just change the value of global variables (gstrRptCmd, gstrRptPaperSize..etc)

    actually, i was able to load the report, but it consumes a lot of memory, that's why when i call again the frmcrviewer.frm, the program exits.

    im attaching the code i use.. pls. help...

    thanks in advance

    -- alexis


    VB Code:
    1. ' FORM NAME = frmCRviewer.frm
    2. Option Explicit
    3. Dim crxApplication As CRAXDDRT.Application
    4. Dim crxReport As CRAXDDRT.Report
    5. Dim crxDatabase As CRAXDDRT.Database
    6. Dim adoCReportRS As ADODB.Recordset
    7. Dim dbx As ADODB.Connection
    8.  
    9. Private Sub Form_Load()
    10.  
    11.     Me.Caption = gstrRptTitle
    12.     Set dbx = New ADODB.Connection
    13.     dbx.CursorLocation = adUseServer
    14.     dbx.Open gstrConnectString
    15.     Set adoCReportRS = New ADODB.Recordset
    16.    
    17.     Set crxApplication = New CRAXDDRT.Application
    18.     Set crxReport = New CRAXDDRT.Report
    19.     Set crxDatabase = crxReport.Database
    20.    
    21.     Call InitializeViewer
    22.  
    23. End Sub
    24.  
    25. Private Sub Form_Resize()
    26.     CRViewer1.Height = Me.ScaleHeight
    27.     CRViewer1.Width = Me.ScaleWidth
    28. End Sub
    29.  
    30. Private Sub InitializeViewer()
    31.    
    32.     On Error Resume Next
    33.     ' gstrRptCmd is a global variable that containing the sql statement
    34.     adoCReportRS.Open gstrRptCmd, dbx, adOpenStatic, adLockReadOnly  
    35.     Set crxReport = crxApplication.OpenReport(gstrRptPath, 1)
    36.     crxReport.DiscardSavedData
    37.    
    38.     crxReport.Database.SetDataSource adoCReportRS , 3, 1
    39.     ' global variable that holds the paper size and paper orientation
    40.     crxReport.PaperSize = gstrRptSize          
    41.     crxReport.PaperOrientation = gstrRptOrientation
    42.    
    43.     crxReport.Sections("PH").ReportObjects("CompanyName").SetText gstrCompanyName
    44.     crxReport.Sections("PH").ReportObjects("ReportTitle").SetText gstrRptTitle
    45.     crxReport.Sections("PH").ReportObjects("ReportSubTitle").SetText gstrRptSubTitle
    46.    
    47.     CRViewer1.ReportSource = crxReport
    48.     CRViewer1.ViewReport
    49.     Do While crxReport.PrintingStatus.Progress = crPrintingInProgress
    50.         DoEvents
    51.     Loop
    52.     Set crxApplication = Nothing
    53.     Set crxDatabase = Nothing
    54.     Set crxReport = Nothing
    55.  
    56. End Sub
    Last edited by RobDog888; Feb 27th, 2006 at 02:15 AM. Reason: Added [vbcode] tags

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Crystal Report viewing Plss. help

    Welcome to the Forums.

    I see two areas of concern, the CursorLocation being on the server side and the Do Loop with the DoEvents in it.

    Shouldnt you be using the "crxReport.PrintOut True, 1" for Printing instead of PrintingStatus? Which version are you running?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Feb 2006
    Posts
    208

    Re: Crystal Report viewing Plss. help

    im using crystal report v9.2

    thanks, i'll try using the CursorLocation on the client side...

    regards to you.

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Crystal Report viewing Plss. help

    The other things was that this loop is sucking up resources with its intense looping.
    VB Code:
    1. Do While crxReport.PrintingStatus.Progress = crPrintingInProgress
    2.         DoEvents
    3.     Loop
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Feb 2006
    Posts
    208

    Re: Crystal Report viewing Plss. help

    i tried the adUseClient and get rid of the do events, but nothing was changed.. my application uses at 17mb of memory before the crystal report was called, then it rises up to around 40mb after i called the form containing this code.

    can you post other way of viewing crystal report?? (if any),

    thanks again.

    alexis

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Crystal Report viewing Plss. help

    Yes, I have an example in my signature.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Feb 2006
    Posts
    208

    Re: Crystal Report viewing Plss. help

    how can i view it,.. im a newbie here...

    aleixs

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Feb 2006
    Posts
    208

    Re: Crystal Report viewing Plss. help

    oh.. i saw it.. tks again.. i'll try the code.

    alexis

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Feb 2006
    Posts
    208

    Re: Crystal Report viewing Plss. help

    your code was really a great help... the memory consumption didn't changed by it doesn't exits the program.

    thank you very much...

  10. #10
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [RESOLVED] Crystal Report viewing Plss. help

    It could also be sucking up memory from a large recordset being opened.

    Thanks
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  11. #11

    Thread Starter
    Addicted Member
    Join Date
    Feb 2006
    Posts
    208

    Re: [RESOLVED] Crystal Report viewing Plss. help

    what if it is really a large recordset? is there any solution? because im developing an inventory system, the records could take up a year or more.

    alexis

  12. #12
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: [RESOLVED] Crystal Report viewing Plss. help

    Quote Originally Posted by alexis23
    what if it is really a large recordset? is there any solution? because im developing an inventory system, the records could take up a year or more.

    alexis
    Why do you need to have all of your records in one recordset? Just bring back a recordset of what is needed at the time.

  13. #13
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [RESOLVED] Crystal Report viewing Plss. help

    I have a client that runs a major MRP program that returns massive recordsets that produce CR reports that are over 1000 pages+ easy.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  14. #14

    Thread Starter
    Addicted Member
    Join Date
    Feb 2006
    Posts
    208

    Re: [RESOLVED] Crystal Report viewing Plss. help

    yup.. i know, but there are reports that should be printed their history like "stock movement report" or alike.

    anyway, i have another post, i hope you could me for that matter too..

    thanks

    alexis

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