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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refreshing Crystal through VBA

Status
Not open for further replies.

S3066

Technical User
Aug 1, 2001
66
US
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top