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!

Refreshing Crystal Report from Visual Basic

Status
Not open for further replies.

Terpsfan

Programmer
Dec 8, 2000
954
US
I have set up a project to use the Crystal activex control to open reports based on date criteria. The problem is that the reports aren't refreshing as the data refreshes. Whenever I pull up the report it still has the old data in it. How do I open a report with the latest data? Thanks.
 
Start by looking at this FAQ on the Saved Data Trap
( faq766-1006 )
Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Unfortunately that didn't help me out - the report opens but doesn't refresh. I believe the problem is more with the Crystal report than the VBCode. It revolves around setting the Database location. I need to use ADO for an Access database. What help can you give me with this? Thanks.
 
What command are you using to pass the recordset to the report. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
If you use CrViewer, you can
In event form_activate, put this code
crviewer.refresh

 
I'm using the Crystal Active X Control, not the CRViewer. In order for me to get the report to refresh, I have to put in code a reference to the refresh button in Crystal:

With CrystalReport1

.ReportSource = crptReport
.ReportFileName = objRec!ReportLocation
If cboMonth <> &quot;&quot; And cboYear <> &quot;&quot; Then
.SelectionFormula = &quot;{&quot; & strReportName & &quot;.MONTH} = '&quot; & cboMonth & &quot;'&quot; & _
&quot;AND {&quot; & strReportName & &quot;.YEAR} = '&quot; & cboYear & &quot;'&quot;
End If
If cboQTR <> &quot;&quot; Then
.SelectionFormula = &quot;{&quot; & strReportName & &quot;.QUARTER} = &quot; & cboQTR & &quot;&quot;
End If

.WindowState = crptMaximized
.Destination = crptToWindow
.Formulas(0) = &quot;Title = '&quot; & objRec!ReportName & &quot;'&quot;
.WindowShowRefreshBtn = True
.Action = 1

End With


which isn't the most efficient way to refresh the report because it requires the user intevention. I want the report to refresh automatically. How would I incorporate the CR Viewer?
 
Now you have lost me. Is the report opening with old data, or is it opening with no data? If it is opening with old data it is because it has saved data.

I also didn't understand this:
&quot;It revolves around setting the Database location. I need to use ADO for an Access database.&quot; Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
hi i making a bill VB6.0 and i want to use crystal report for bst performance means to take printout. and i have make a database in SQL Server 7.0 so please guide me how can i use crystal report with sql server7.0 ?
 
Please post this as a new question in the integraton forum. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
may be in the crystal report form, you used &quot;SAVE DATA WITH THE REPORT&quot; in the file menu ?? check this. (sorry for the real spealing but i am using it in french)
amec
 
You have to add a hidden field on the CR. Then you have to pass a parameter in containing the current date/time and assign the field to that variable.

When you run the report again, the variable passed in will contain a different date / time than what is stored in the report field and cause the report to refresh.

It's a pain in the @$$, but it's the only &quot;automatic&quot; refresh method I have found.
 
hi I'am use crystal report and vb6.0 ,I have problem to use &quot;Parameter Field&quot;. Can I pass a value from vb6.0 to Parameter Feild in Crystal Report ? And Can you show me the code to user Parameter Filed ? (sorry for language I'm thai)
thank for your suggestion
 
Please post this as a new question in the integraton forum. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top