Hello everyone,
I have a Crystal that I want to refresh through VBA. The database connection and datasource is already saved with the Crystal. Any ideas on how to accomplish the refresh? What I'm trying to do through VBA is essentially simulating the user action of clicking the lightning bolt button on the toolbar to refresh data.
Below is some code I've started. I'm not sure, though, if I really need to set all the database connection parameters since the Crystal report already has those saved (?).
Dim cRPT As CRAXDRT.Report
Dim crxTable As CRAXDRT.DatabaseTable
Set cRPT = cApp.OpenReport(<name of report>)
cRPT.DiscardSavedData
For Each crxTable In cRPT.Database.Tables
With crxTable.ConnectionProperties
.Item("DSN") = "PeopleSoft PeopleTools"
.Item("VendorType") = "PeopleSoft ODBC"
.Item("Database") = <database name, e.g., we use HRP1>
.Item("User ID") = <my user ID>
.Item("Password") = <my password>
End With
Next
cRPT.Export False
I have a Crystal that I want to refresh through VBA. The database connection and datasource is already saved with the Crystal. Any ideas on how to accomplish the refresh? What I'm trying to do through VBA is essentially simulating the user action of clicking the lightning bolt button on the toolbar to refresh data.
Below is some code I've started. I'm not sure, though, if I really need to set all the database connection parameters since the Crystal report already has those saved (?).
Dim cRPT As CRAXDRT.Report
Dim crxTable As CRAXDRT.DatabaseTable
Set cRPT = cApp.OpenReport(<name of report>)
cRPT.DiscardSavedData
For Each crxTable In cRPT.Database.Tables
With crxTable.ConnectionProperties
.Item("DSN") = "PeopleSoft PeopleTools"
.Item("VendorType") = "PeopleSoft ODBC"
.Item("Database") = <database name, e.g., we use HRP1>
.Item("User ID") = <my user ID>
.Item("Password") = <my password>
End With
Next
cRPT.Export False