MICS
asked on
Data not be refreshed for Crystal reports
I'm using vb 6.0 sp5, Crystal Reports 8.5 to do some reporting, the problem i'm having is that I'm using DAo 3.6 to make changes to the database that my C.R. document links to, i would add a record to my database, then using the OCX for C.R. i would do a print to screen and the data does not exist.. any ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
i would suggest using the Crystal 8.5 RDC.
it has a new ReportViewer object which allows you to simply call a REFRESH routine (and it is faster and looks great)
other than that, once the report is on the screen i don't think you can refresh the data until Crystal loads the report again.
** wait, i read the question wrong **
here is a routine i use to show reports:
'New Instance of FrmPreview that has
'the Crystl32.ocx object on it
Load FrmP
With FrmP.CrystalReport1
'Show Preview
If bShowPrev = False Then
FrmP.CommonDialog1.CancelE rror = True
FrmP.CommonDialog1.ShowPri nter
If Err.Number = cdlCancel Then Exit Sub
End If
.ReportFileName = "Your\Report\here.rpt"
.WindowTop = 0
.WindowLeft = 0
.WindowHeight = (Screen.Height / 17)
.WindowWidth = (Screen.Width / 15)
.SelectionFormula = "Select.Formula"
.WindowParentHandle = FrmP.hwnd
.DataFiles(0) = "Database1\Location\Goes\H ere"
.DataFiles(1) = "Database2\Location\Goes\H ere"
If bShowPrev = True Then
'display report in window
.Destination = crptToWindow
Result = .PrintReport
Else
'print out
.Destination = crptToPrinter
Result = FrmP.CrystalReport1.PrintR eport
End If
If bShowPrev = True Then FrmP.Show
when you set the data location, it should be the latest greatest data.
hope that helps
Kevman63
it has a new ReportViewer object which allows you to simply call a REFRESH routine (and it is faster and looks great)
other than that, once the report is on the screen i don't think you can refresh the data until Crystal loads the report again.
** wait, i read the question wrong **
here is a routine i use to show reports:
'New Instance of FrmPreview that has
'the Crystl32.ocx object on it
Load FrmP
With FrmP.CrystalReport1
'Show Preview
If bShowPrev = False Then
FrmP.CommonDialog1.CancelE
FrmP.CommonDialog1.ShowPri
If Err.Number = cdlCancel Then Exit Sub
End If
.ReportFileName = "Your\Report\here.rpt"
.WindowTop = 0
.WindowLeft = 0
.WindowHeight = (Screen.Height / 17)
.WindowWidth = (Screen.Width / 15)
.SelectionFormula = "Select.Formula"
.WindowParentHandle = FrmP.hwnd
.DataFiles(0) = "Database1\Location\Goes\H
.DataFiles(1) = "Database2\Location\Goes\H
If bShowPrev = True Then
'display report in window
.Destination = crptToWindow
Result = .PrintReport
Else
'print out
.Destination = crptToPrinter
Result = FrmP.CrystalReport1.PrintR
End If
If bShowPrev = True Then FrmP.Show
when you set the data location, it should be the latest greatest data.
hope that helps
Kevman63
The RDC has a .discardsaveddatea method. I think the OCX control may have a similar method or property. If you have a lot of reports, it may be easier to use the method rather than opening each report.
mlmcc
mlmcc
To prevent this problem with future reports,
Open CR
Under FILE (it may be under options)
Click off SAVE DATA WITH REPORT
CR defaults to save the data with the report.
mlmcc
Open CR
Under FILE (it may be under options)
Click off SAVE DATA WITH REPORT
CR defaults to save the data with the report.
mlmcc
ASKER
Thanks, "The Save Data with report" was the problem.
Like damion69 said most likley your problem is that the data got saved with the report. You will need to open the report in Crystal and unclick the "Save Data With Report" option under "File".
What are you using to a DB?