Question : How to refresh Crystal report at run time in vb6

hello dear helper
i want to refresh my crystal report from wintin my application. i have desinged a button to inwok the Crveiwer but every times it shows the previously refreshed data and i had to press the refresh button from the mensu
plz help if u can
thanks
Faisal

Answer : How to refresh Crystal report at run time in vb6

Hi,

You can refresh the report data run time easily.
I am adding the code ,go through this .
Try to use it in your code.

Code starts..........................

rptfilePath = App.Path & "\my report.rpt"

psSelectionQuery = "SELECT EMPID,EMPNAME FROM EMP WHERE EMPID=12"

crpReportControl.ReportFileName = rptfilePath
crpReportControl.Connect = "DSN=cpmd;UID=cpmd;PWD=cpmd123"
crpReportControl.SQLQuery = selectionformula
crpReportControl.destination = crptToWindow
 crpReportControl.Action = 1

cODE ENDS..............................

In this way your report get fresh data each time as it will execute the query everytime.

Also Ensure SAVE DATA WITH REPORT is not checked.

I think this will solve your problem.

Enjoyyyyyyyy

Maddy
Random Solutions  
 
programming4us programming4us