Link to home
Start Free TrialLog in
Avatar of MICS
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
Avatar of damion69
damion69

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Use the OCX! there is nothing wrong with it for simple reports and it does keep down on the install size.

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?
Avatar of kevman63
kevman63

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.CancelError = True
        FrmP.CommonDialog1.ShowPrinter
        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\Here"
    .DataFiles(1) = "Database2\Location\Goes\Here"
           
    If bShowPrev = True Then
        'display report in window
        .Destination = crptToWindow  
        Result = .PrintReport
        Else
        'print out
        .Destination = crptToPrinter      
        Result = FrmP.CrystalReport1.PrintReport
        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
Avatar of Mike McCracken
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
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
Avatar of MICS

ASKER

Thanks, "The Save Data with report" was the problem.