Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

refreshing crystal reports problems...

Status
Not open for further replies.

Erikxxx

Programmer
May 5, 2003
49
GB
Hi,

I know this problem has been posted here before and i have tried to do what's been written, but without success.

I'm using crystal reports v6 and Ms Access.

The problem as been discussed before is that the preview windows doesn't refresh with accurate data (well, sometimes is does). If i put a msgbox before the crystaRep.printReport statement it always work. So the problem is with refreshing from the database.

The reports are derived from a table in Access that gets populated each time i click the preview button. It seems that most of the time crystal report open an empty table even if i have added data to it before i print the report.

I have tried to set crystalReport.DiscardSavedData = true
and
i made sure crystalreports doesn't save any data.

Are there any other parameter that i can use to be able to refresh my reports. Or how can i get around the problem? It might even be the database that have to be refreshed.. i dont know.

Regards
Erik
 
From what I read into this, it sounds as though you are actually populating the database table at about the same time as you are reporting off it.

Given that you can stop the code with a msgbox. This act may be allowing access to fill the table before the report gets executed which would happen on the .PrintReport

The report could conceivable run way faster than your data population and as a result bring back nothing. Also the fact that you are not seeing an error is indication that everying on the Crystal end is working as expected.

I would suggest populating the table prior to your report sequence, or add a Sleep for a few seconds before you print.

You could also do a .ReadRecords and if the record count = 0 then loop around and do this until the count is greater than 0 then proceed. This is more logical than a sleep unless you know for certain the data, all the data will be in the table for the report.

I assumed you are using the RDC and not the OCX control in your app. Both have a .PrintReport method


Cheers,

SurfingGecko
Home of Crystal Ease
 
Hi SurfingGecko

thanks for your fast reply.

Well, i have 2 functions and the first one is populating the database (using ADO)

the second function is doing the crystalReport.printReport (using the ocx controller)

Even if i sequently run them in order it didn't work. In my first function i open a recordset and add data to it. However it seems to work if i requery (rst.requery) the recordset after the update.

Well, i'm not using crystal reports very often but thanks very much for those advices you gave me.. It will definitely help me in the future..

Thanks alot

Erik
 
Hmmm.

It should work fine so long as your database population routine has run to completion before you run the report phase.

How is your report collecting data? ODBC or are you passing rst. to the report?

If everything works after you requery the rst, why not try moving your cursor in the rst to the begining.

It might be that the cursor is at the EOF.

If you have trouble you may want to post your code sequence so we can have a look see

Cheers,

SurfingGecko
Home of Crystal Ease
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top