|
-
Feb 27th, 2006, 02:10 AM
#1
Thread Starter
Addicted Member
[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:
' FORM NAME = frmCRviewer.frm
Option Explicit
Dim crxApplication As CRAXDDRT.Application
Dim crxReport As CRAXDDRT.Report
Dim crxDatabase As CRAXDDRT.Database
Dim adoCReportRS As ADODB.Recordset
Dim dbx As ADODB.Connection
Private Sub Form_Load()
Me.Caption = gstrRptTitle
Set dbx = New ADODB.Connection
dbx.CursorLocation = adUseServer
dbx.Open gstrConnectString
Set adoCReportRS = New ADODB.Recordset
Set crxApplication = New CRAXDDRT.Application
Set crxReport = New CRAXDDRT.Report
Set crxDatabase = crxReport.Database
Call InitializeViewer
End Sub
Private Sub Form_Resize()
CRViewer1.Height = Me.ScaleHeight
CRViewer1.Width = Me.ScaleWidth
End Sub
Private Sub InitializeViewer()
On Error Resume Next
' gstrRptCmd is a global variable that containing the sql statement
adoCReportRS.Open gstrRptCmd, dbx, adOpenStatic, adLockReadOnly
Set crxReport = crxApplication.OpenReport(gstrRptPath, 1)
crxReport.DiscardSavedData
crxReport.Database.SetDataSource adoCReportRS , 3, 1
' global variable that holds the paper size and paper orientation
crxReport.PaperSize = gstrRptSize
crxReport.PaperOrientation = gstrRptOrientation
crxReport.Sections("PH").ReportObjects("CompanyName").SetText gstrCompanyName
crxReport.Sections("PH").ReportObjects("ReportTitle").SetText gstrRptTitle
crxReport.Sections("PH").ReportObjects("ReportSubTitle").SetText gstrRptSubTitle
CRViewer1.ReportSource = crxReport
CRViewer1.ViewReport
Do While crxReport.PrintingStatus.Progress = crPrintingInProgress
DoEvents
Loop
Set crxApplication = Nothing
Set crxDatabase = Nothing
Set crxReport = Nothing
End Sub
Last edited by RobDog888; Feb 27th, 2006 at 02:15 AM.
Reason: Added [vbcode] tags
-
Feb 27th, 2006, 02:15 AM
#2
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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 
-
Feb 27th, 2006, 02:40 AM
#3
Thread Starter
Addicted Member
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.
-
Feb 27th, 2006, 02:43 AM
#4
Re: Crystal Report viewing Plss. help
The other things was that this loop is sucking up resources with its intense looping.
VB Code:
Do While crxReport.PrintingStatus.Progress = crPrintingInProgress
DoEvents
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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 
-
Feb 27th, 2006, 03:52 AM
#5
Thread Starter
Addicted Member
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
-
Feb 27th, 2006, 03:59 AM
#6
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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 
-
Feb 27th, 2006, 04:05 AM
#7
Thread Starter
Addicted Member
Re: Crystal Report viewing Plss. help
how can i view it,.. im a newbie here...
aleixs
-
Feb 27th, 2006, 04:06 AM
#8
Thread Starter
Addicted Member
Re: Crystal Report viewing Plss. help
oh.. i saw it.. tks again.. i'll try the code.
alexis
-
Feb 27th, 2006, 04:44 AM
#9
Thread Starter
Addicted Member
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...
-
Feb 27th, 2006, 05:00 AM
#10
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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 
-
Feb 27th, 2006, 05:52 AM
#11
Thread Starter
Addicted Member
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
-
Feb 27th, 2006, 07:04 AM
#12
Re: [RESOLVED] Crystal Report viewing Plss. help
 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.
-
Feb 27th, 2006, 10:32 AM
#13
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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 
-
Feb 27th, 2006, 07:32 PM
#14
Thread Starter
Addicted Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|