Wrox Programmer Forums
|
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 6th, 2008, 09:56 AM
Authorized User
 
Join Date: Aug 2007
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to zrtv
Default VB access Crystal report

Hi all,
I have a vb6 program,MS access as backend with crystal report9,
one of the table have around 16000 records. when i try to fetch the data from this table through crystal report 9, it takes long time

My database have field like

1)IssueNum
2)IssueDate
3)ProductCode
4)Uom
5)Qty

if I am fetching record between dates, even if its 2 days record
it takes around 5 to 10 minutes to generate the report


can some one tell me which vb6 code can help me to fastened the report generation?

 
Old November 8th, 2008, 01:01 AM
Authorized User
 
Join Date: Aug 2007
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to zrtv
Default

The problem i described above I am writing down my code snippet

Private Sub mitrns()
On Error GoTo err_handler
If Text1.Text = "" Or Text2.Text = "" Then
    rsrpt.Open "select*from materialissue where midate>=#" & DTPicker1.Value & "# and midate<=#" & DTPicker2.Value & "#", db, adOpenForwardOnly, adLockReadOnly
Else
    rsrpt.Open "select*from materialissue where mino>=" & Val(Text1.Text) & " and mino<=" & Val(Text2.Text) & "", db, adOpenForwardOnly, adLockReadOnly
End If
    Set report = crystal.OpenReport(App.Path & "\report\Issuetrns.rpt") 'OPEN OUR REPORT

rptcall

Exit Sub
err_handler:
If ERR.Number > 0 Then
   MsgBox ERR.Description, vbCritical
End If
End Sub

Private Sub rptcall()
On Error GoTo err_handler
report.DiscardSavedData 'CLEARS REPORT SO WE WORK FROM RECORDSET

report.ParameterFields.GetItemByName("docFrom").Ad dCurrentValue Val(Text1.Text)
report.ParameterFields.GetItemByName("docTo").AddC urrentValue Val(Text2.Text)
report.Database.SetDataSource rsrpt 'LINK REPORT TO RECORDSET
CRViewer.Zoom (100)
CRViewer.ReportSource = report 'LINK VIEWER TO REPORT
CRViewer.ViewReport

'SHOW REPORT
Do While CRViewer.IsBusy 'ZOOM METHOD DOES NOT WORK WHILE
   DoEvents 'REPORT IS LOADING, SO WE MUST PAUSE
Loop 'WHILE REPORT LOADS.

rsrpt.Close
Exit Sub
err_handler:
If ERR.Number > 0 Then
   MsgBox ERR.Description, vbCritical
End If
End Sub

 
Old November 8th, 2008, 06:13 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Do you have any index on that fields???, could be a problem with the data fetch...

in which line does the program takes long????

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
simple report and crystal report in vb.net saket123 .NET Framework 2.0 0 August 13th, 2008 06:55 AM
VB with crystal report monika.vasvani VB Databases Basics 0 May 24th, 2008 12:55 PM
Crystal Report 8.5, VB 6.0 and MS ACCESS 2003 artarasan Beginning VB 6 1 May 14th, 2008 06:50 AM
VB 6 and Crystal Report zaeem VB Databases Basics 1 May 9th, 2005 09:51 PM
How to use Crystal Report 9 with VB hafizfarooq Crystal Reports 0 May 8th, 2005 03:02 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.