Discussion Locked

Crystal Reports

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
Is there a way to call a crystal report from a vb app and have the data be refreshed? What I am doing now is refreshing the data, saving the reports and then allowing users to view them.

5 replies

by vinnyd

Yes there is. I do it in my VB applications that need reports. Listed below is the sample code that I use.

If OutputList.Text = "Window" Then
OutputDestination = 0
Else
If OutputList.Text = "Printer" ThenOutputDestination = 1
Report1.CopiesToPrinter = Number_Of_Copies
Else
If OutputList.Text = "File" Then
OutputDestination = 2
Report1.PrintFileName = Output_File_Name Report1.PrintFileType = Output_File_Type
End If
End If
End If
Report1.Destination = OutputDestination

' Set location of the database file to the location from
' which the user ran the app

LocText$ = LCase(App.Path)
If Right$(App.Path, 1) <> "\" Then LocText$ = LocText$ + "\" 'handles the root
Report1.DataFiles(0) = LocText$ + "\deansteel.mdb"
Report1.ReportFileName = LocText$ + "rptCutEdit.rpt"
' EXECUTE PRINT CALL
On Error GoTo ErrorHandler
Report1.Action = 1
Exit Sub

by miss kitty

In your Crystal Report, under options, uncheck save data with report and check discard when loading reports. This is located on the reporting tab. Everytime you load the report, it will refresh with your current data.
Cathy
covcat@riverstonegrp.com

This discussion is closed to new replies.