dayiku
asked on
How can i refresh report values from the database
I have a vb application that pulls up a crystal report.
I can view the report but for some reason i cannot view updated values from the database.
Can somebody help me on how to refresh the report so that any data added or removed will show up on the prompts for the report.
Below is my code,
Set Report = Appl.OpenReport("c:\crysta l_report.r pt")
Report.DiscardSavedData
Report.Database.Tables(1). SetLogOnIn fo "machinename", "databasename", "userid", "password"
CRViewer1.DisplayToolbar = True
CRViewer1.EnableRefreshBut ton = True
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
I am connecting to an oracle database through an odbc connection
I can view the report but for some reason i cannot view updated values from the database.
Can somebody help me on how to refresh the report so that any data added or removed will show up on the prompts for the report.
Below is my code,
Set Report = Appl.OpenReport("c:\crysta
Report.DiscardSavedData
Report.Database.Tables(1).
CRViewer1.DisplayToolbar = True
CRViewer1.EnableRefreshBut
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
I am connecting to an oracle database through an odbc connection
ASKER
That did not work.
I opened up the file in Crystal Reports and the "Save data with report" was unchecked"
I then added the Report.ReadRecords to my file but i still get the same values.
I have version 8.5
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Actually it seems to be connecting properly.
Do you have the instructions for connecting to an oracle database?
Do you have the instructions for connecting to an oracle database?
If you have access to the report file itself, and can edit it then you should check the File menu and see if the "Save data with report" menu item is checked. If it is, then uncheck it and save the report. That usually solves it.
If that doesn't work then try the ReadRecords method of the report object like this:
Set Report = Appl.OpenReport("c:\crysta
Report.DiscardSavedData
Report.Database.Tables(1).
Report.ReadRecords
If you still can't get it to work, please let us know which version of Crystal reports your're using.
Good luck,
Ron