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!

Updatin Reports

Status
Not open for further replies.

chris77

Technical User
May 6, 2003
5
DE
I build Summary reports from my Access database using VB Crystal Reports Pro and also wrote a VB 5 program that allows the user to add edit and remove records from the database. So what I would like to do is update the summary reports when the user adds, edit or removes any record. Is there a way to do that. I'm ussing "Microsoft
DAO Object Library" to make my database connection. Here is how I'm doing it:

Option Explicit

Dim db As Database
Dim rs As Recordset
Dim ws As Workspace
----------------
Private Sub Form_Load()
Set ws = DBEngine.Workspaces(0)
Set db = ws.OpenDatabase(App.Path & "\mydata.mdb")
Set rs = db.OpenRecordset("Projects", dbOpenTable)

end Sub

Then I'm ussing rs.edit rs.addnew and rs.delete to add and remove a record respectively. So does have any one any sample code to update summary reports that I can look at or give me some ideas how to do this. Thanks in advance for all the help that I can get...



 

Close the current report(s) and then reopen them is the only way I know how. This should allow the reports to refresh their data(do not save data with reports). What I am not sure about is does your program spawn the reports or are you allowing the users some other method of viewing the reports. If they are using CR design environment itself then they can refresh the data from there.

 
vb5prgrm: I want my user to be able to view the reports with the current changes.
 

Chris77,

To my understanding when Crystal Reports are run they access the data to display. Once the data is displayed they close their connection to the datasource. Thus making the report displayed static or a snapshot of the data at the time of the query. The only way to make a CR "realtime" is for every action you need to program a reaction, i.e. close and reopen so the report has its data refreshed. You can however create your own form that displays the data that you want but you will still have the problem of "for every action you will need to program the reaction".

Sorry I cannot be of any more help
 
vb5prgrmr

Is there a metnod in the crystal report control to update the reports. For example to display the report use the .printreport method i.e CrystalReport1.PrintReport.
Or do you know of a website that I can look at for control methods. Thanks....

 

Chriss77

You can try seagate or microsoft's web sites but I doubt you will find anything on the CrystalReport1 control version 4.5 or 4.6 (or whatever it is that comes with VB 5.0) since it is discontinued and is only included with the later versions of crystal reports for backward compatibility.

 
Thanks for all your help vb5pgrm, I think I figured it out. Once again thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top