Click to See Complete Forum and Search --> : Crystal report do not refresh
Khalique
Aug 13th, 2006, 06:17 AM
Hi, I am new in vb as well as crystal report. I am using crystal report 10 in vb6. When I call crystal report using CRAXDRT in vbfirst time data comes automatically but next time when i click the refresh button then only the new data comes, where ever I am using dicardsavedata as well as refresh. My code are as
Public Sub doopen1(rptname As String)
Dim crxapplication As New CRAXDRT.Application
Dim crxreport As New CRAXDRT.Report
Dim strx As String
CrView.EnablePrintButton = True
strx = App.Path
If Right(strx, 1) <> "\" Then
strx = strx & "\"
End If
strx = strx & "report\" & rptname
Set crxreport = crxapplication.OpenReport(strx)
CrView.EnableRefreshButton = True
CrView.ReportSource = crxreport
CrView.Refresh
CrView.ViewReport
CrView.Zoom 100
Me.Show 1
crxreport.DiscardSavedData
' CrView.RefreshEx (True)
CrView.Refresh
End Sub
where as my crystal report is bounded with an Access table.that is altered no problem with that.
Pls help
RobDog888
Aug 13th, 2006, 12:32 PM
Welcome to the Forums.
I'm not familiar with version 10 but shouldnt you be setting your DataSource property too.
Moved
Khalique
Aug 13th, 2006, 11:48 PM
Thanks, what do you mean I could not understand. I search but there is no any datasource property in Crystal report Active X viewer. Can you explain little bit more. Still I have same problem unless and untill I do not click refresh button it doesn't refresh. Waiting from your side.
RobDog888
Aug 14th, 2006, 12:15 AM
Well I dont have 10, only 8.5 so its probably different. But where are you setting your connection source (datasource) property? It would be the source of data for your report object - crxreport
Khalique
Aug 14th, 2006, 12:38 AM
Thanks, my crxreport(craxdrt report) is taking data from an .rpt file and that .rpt file is directly taking data from an access table. here if I will directly see the rpt file that is ok and alteresd every time but the altered report is not coming to crystal report active x viewer I.E. on the vb form.
pnish
Aug 14th, 2006, 01:39 AM
In your .rpt file, make sure that the option to Save Data with Report is NOT checked.
RobDog888
Aug 14th, 2006, 02:34 AM
If it is checked or not, having the call to .DiscardSavedData right after your opening of the report should do it.
crxreport.DiscardSavedData
Khalique
Aug 14th, 2006, 04:20 AM
Thanks, Save Data With Report Is Already Unchecked From Both The Option In File Menu. I Did Discardsave Data Also At The Appropriate Position. Actually What Happens When I First Open Report Through Vb Then It Works But When I Close It And Reopen The Report Through Vb Without Rerun The Project Then Untill I Didn't Press Refresh Button It Dosen't Refresh.
jeruelx5d
Aug 14th, 2006, 04:23 AM
If you have a recordset that loads data into your access database, before calling your .rpt file make sure to close the recordset declaration.
Are you using temporary database for your crystal report? if not just do it, and make your temporary database connected to crystal...
Everytime you call a report, kill the existing temporary database and replace it with new blank temporary database (of course you have to make tables but no record) then load data from recordset that you want to be displayed. Close the recordset declaration and connections string, then you can now call your .rpt file (.rpt file is connected to temporary database.)
Khalique
Aug 14th, 2006, 05:15 AM
Thanks, still I am facing same problem. I did close the recordset. I don't know how to assign a record set to a rpt file from vb where as I need some particular colums and some specific records from MASTERTABLE. I can't use RDC.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.