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!

ADODB.Connection and Crystal logon?

Status
Not open for further replies.

S3066

Technical User
Aug 1, 2001
66
US
Hello,

I have some VBA code that establishes an ADODB.Connection. Is there any way I can use that ADODB.Connection to log on and refresh a Crystal report?

Below is my ADODB code where I establish a "Cn" variable containing the ADODB connection parameters. What I was hoping to do is use this ADODB connection to refresh a Crystal.

Conn = "DSN=<dsn name>;DBNAME=<dbname>"
Set Cn = New ADODB.Connection
Cn.Properties("Prompt") = adPromptComplete
With Cn
.ConnectionString = Conn
.CursorLocation = adUseClient
.Open
End With
...

Then I hope to use above ADODB connection to log on and refresh an existing Crystal? I know how to open a Crystal and then am trying to use the following code to log on. Variable crxTable is a table in the Crystal report that I'm trying to refresh.

With crxTable.ConnectionProperties
.Item("DSN") = <DSN name>
.Item("VendorType") = <vendor type>
.Item("User ID") = <userID>
.Item("Password") = <password>
'End With

 
ADO connects to databases

Crystal reports is a BI application

You can, afaik, use VBA to automate Crystal but it would not be with ADO....ADO would be used to run the same SQL query that populates a Crystal report, against a database and then bring the data into excel

Crystal will have its own object model that is exposed to VBA - you would need to find the appropriate properties in that object model and utilise them if you want to automate this. Would suggest posting in one of the Crystal forums as no doubt people in there will have done this kind of thing before

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top