Link to home
Start Free TrialLog in
Avatar of Ogueds
Ogueds

asked on

Crystal Report Not Refreshing

I have a VB application with Crystal Reports incorporated through ActiveX components.  When I run the CRViewer the Report which connects through ODBC with AS400 back-end is not refresh to the latest changes in the backend.  I must enable Crystal Report's refresh button so users can refresh the data.  I have already disable 'Save Data with Report' in Crystal Report Designer prior to importing the report into VB.  When I click on refresh button the report is refresh with the latest data. Should I include VB code in the CRViewer so the report gets refresh automatically once is loaded ?
How do I do this ?  Please provice sample code.

Thank you.
Avatar of Dave_Greene
Dave_Greene

Add a Timer control to your project and add this code

Private Sub Form_Load()
  With Timer1
    .Interval = 60000  'set to trigger every 1 minute (it's max value)
    .Enabled = True
  End With
End Sub

Private Sub Timer1_Timer()
  CRViewer1.Refresh  <-- Call the refresh here
End Sub
Prior to calling the CRViewer1.ViewReport method, set these properties:

CRViewer1.DisplayToolbar = True
CRViewer1.EnableRefreshButton = True

This will allow your users to refresh the data on demand.
ASKER CERTIFIED SOLUTION
Avatar of Aaron_Young
Aaron_Young
Flag of United States of America image

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
Hi

It is very simple. Set the Crystal Report OCX property "DiscaredSaveData" to true. This will solve your problem.

siva
NellaiSiva -

Your account was created in March - you should know how things work around here by now.  Do not propose an answer unless you are more than 100% sure it is correct.  Yours is not.  Not only have you misspelled the property name, but your proposed answer repeats Aaron_Young's comment.

Oqueds - please REJECT the proposed answer.
Proposed answer rejected.

ComTech
Community Support Moderator
From EE Policy:

Advice for Experts on Providing Solutions Through Comments or Answers Experts may post solutions to your question in the form of a comment or answer, so be sure to check every email notification as soon as it arrives. Often, an Expert posts the solution to your problem as a comment because it is early in the collaboration process and other issues may be involved. In addition, it is common etiquette in some topics areas to always post comments and not answers. There are several reasons behind this thinking:

Questions do not become prematurely locked and the collaboration process is not inhibited when the question
is indexed as open for proposed solutions. The question-asker has the power to select the best solution rather than one that is simply suggested as an answer.

Watch out for unclear or multiple-part questions. You can send a comment to the member requesting that they rephrase or break up the question before you submit an answer.
If you don't know the answer, leave the question for someone else.

If you are unsure of your solution, post it as a comment rather than an answer. Members can accept comments as solutions and award points for them. You are only responsible for providing one reasonable answer.
You may review information about a member, including their grading history, by clicking on their member name.
If you're having a problem with a Member, you can refer it to us.


Thank you,
ComTech
Community Support