Data Connectivity
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Data Connectivity
Message Icon Topic: Blank Report Post Reply Post New Topic
Author Message
lostpacket
Newbie
Newbie
Avatar

Joined: 08 Apr 2011
Online Status: Offline
Posts: 3
Quote lostpacket Replybullet Topic: Blank Report
    Posted: 08 Apr 2011 at 7:45am
Hi

The crystal report I have works fine when I run it from crystal reports application. But when I do this by code , it gives me a blank report. I don't know why.
The crystal report has one SQL and one OLD DB (ADO) connection.
Here is the code I use to call the report from a VB application.

Private Sub UserForm_Initialize()

    Dim crxApp As New CRAXDRT.Application
    Dim cr As CRAXDRT.Report
    Set cr = crxApp.OpenReport("C:\Report.rpt")
    cr.RecordSelectionFormula = "{Customers.Name} = '" & frmReport.NameList.Text & "'"
    cr.Database.Tables(1).ConnectionProperties("User ID") = "sa"
    cr.Database.Tables(1).ConnectionProperties("Password") = "password"
    crViewer1.ReportSource = cr
    crViewer1.ViewReport

End Sub


I am passing the SQL user name and password here.
I am not passing OLE DB historian source username and password.
The OLD DB historian information is used in a sub report.
The report used to work well but don't know calling from VB creates a problem.

Sometimes I get log on error like "API Error" Invalid username and/or password" from crystal viewer informational message box.
Let me know if i m missing something ?



IP IP Logged
jkwrpc
Senior Member
Senior Member


Joined: 19 Jun 2007
Location: United States
Online Status: Offline
Posts: 432
Quote jkwrpc Replybullet Posted: 11 Apr 2011 at 8:43am
If you dont pass them in code are you prompted for them when you run the report? Try commenting the thos lines out and then run the report and see if the login dialog appears.
 
With CR its hard to know for sure which connection is failing, given the multi-pass nature of report generation, with subreports going last.
 
My initial reaction is that since you have two different  connections and if they each require passwords you will very likely have to pass them to the connection in the code. Dong one set will not take care of it. I dont recall off the top of my head how the subreport connection is exposed, but I have worked with it in the past.
 
I hope this gives you some suggestions of things to look for.
 
Regards,
 
John W.
 
 
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 11 Apr 2011 at 10:01am
Yes, you have to be sure to explicitly set the logins for the tables in the subreport in addition to the ones for the main report.
 
-Dell
IP IP Logged
lostpacket
Newbie
Newbie
Avatar

Joined: 08 Apr 2011
Online Status: Offline
Posts: 3
Quote lostpacket Replybullet Posted: 11 Apr 2011 at 12:21pm
That's what I did and it works like charm.
I am sorry I didn't share this.
I hope it'll help others.
IP IP Logged
lostpacket
Newbie
Newbie
Avatar

Joined: 08 Apr 2011
Online Status: Offline
Posts: 3
Quote lostpacket Replybullet Posted: 11 Apr 2011 at 12:23pm
Originally posted by jkwrpc

If you dont pass them in code are you prompted for them when you run the report? Try commenting the thos lines out and then run the report and see if the login dialog appears.

 

With CR its hard to know for sure which connection is failing, given the multi-pass nature of report generation, with subreports going last.

 

My initial reaction is that since you have two different  connections and if they each require passwords you will very likely have to pass them to the connection in the code. Dong one set will not take care of it. I dont recall off the top of my head how the subreport connection is exposed, but I have worked with it in the past.

 

I hope this gives you some suggestions of things to look for.

 

Regards,

 

John W.


 

 


Provided credentials explicitly for each sub report..
Thanks !!!
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.