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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal Reports Data Refresh from Code: VB5 and Access Db Problem

Status
Not open for further replies.

NatHunter

Technical User
Aug 17, 2001
51
GB
I've got a VB5 program which writes to an MS Access db.

I've got a query in the Access Db which pulls out the records that I want.

I've got a Crystal Report that uses data from the access query.

I can access the report from the program and view it and print it, but I can't work out how to refresh the data in the report from the VB program.

Hopefully someone may know how to do this...

Thanks for your time
 
This is a FAQ I just wrote that might apply to you. Since I just posted it, you can't see it for a while, so here it is:

Crystal Reports has a handy option of allowing you to save data with a report. This allows you to run or view a report without having access to the database that the data was drawn from. CR does this by saving the necessary records and fields as part of the RPT file.

My complaint is that when you first install CR this feature is always defaulted to ON. This means that until you shut this feature off, every report is saved with the records used for the last run of the report. This wastes space, and causes a great deal of confusion for developers. I have yet to come up with a reason for why they set this option to "ON". Maybe it is because Seagate Software was affiliated with Seagate Hardware, and they want you to buy a bigger disk drive.

Anyway, the test to see if your report has saved data is simply to close it and reopen it in the report designer. If it immediately goes to preview, without your touching any keys, then you have saved data. If it opens in design mode, then you don't have saved data.

To shut the feature off you have to go to 2 different places. To shut it off for an existing report you open that report and go to File - REPORT options. You can also turn it back on here for this one report.

To change the global default for all new reports created you go to File - Options, and select the Reporting tab.

Now, when you shut this off, you might get a new error when you run your report from your VB application. That is actually good news. It means that now your report is TRYING to connect to the database (and failing). But at least it is trying. Ken Hamady, On-site/Phone Crystal Reports Training/Consulting
Quick Reference Guide to using Crystal in VB
 
Thanks very much - yep, that's done the trick ! Can't think why it was coded that way.

On the same subject, is it possible to filter records from a report that is based on an MS Access Query ? The query might not be date-specific, for example, but I might want to set a date in code...

Thanks again !
 
The selection formula should filter the records further. Ken Hamady, On-site/Phone Crystal Reports Training/Consulting
Quick Reference Guide to using Crystal in VB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top