Visual basic code to automatically refresh a crystal report
Posted on 2011-09-02
The following is the Visual basic code to create a executable option to call crystal reports
I would like to put in an automatic refresh into this code - every x minutes the crystal report is to be refreshed
what is the visual basic code for this and where in the code below would I put in this code ?
Private Sub Form_Load()
Dim CRapp As CRAXDRT.Application
Dim ConnectionInfo As CRAXDRT.ConnectionProperties
Dim con As CRAXDRT.ConnectionProperties
Dim rpt As CRAXDRT.Report
Set CRapp = New CRAXDRT.Application
Set rpt = CRapp.OpenReport("U:\file name.rpt")
Set ConnectionInfo = rpt.Database.Tables(1).ConnectionProperties
ConnectionInfo.Item("DSN") = "DSN"
ConnectionInfo.Item("Database") = "Database"
ConnectionInfo.Item("User ID") = "UserID"
ConnectionInfo.Item("Password") = "password"
Screen.MousePointer = vbHourglass
CRViewer1.ReportSource = rpt
Screen.MousePointer = vbDefault