I make crosstab crystal report and then want to display it through vb, it display error
I am using
Crystal Report 9
Visual Basic 6
I make crosstab crystal report and then want to display it through vb, it display error
I am using
Crystal Report 9
Visual Basic 6
It would be good if you post :
a) the code where you call the rpt
b) the data source properties that you use in the rpt
JG
... If your problem is fixed don't forget to mark your threads as resolvedusing the Thread Tools menu ...
I didn't use any code to view this report.
I created this report in crystal report 9 through crosstab wizard and want to display in vb6.
My database has password and i give it in cr9, it is working, but in vb there is an error even though i set its password by right clicking on database fields and set database location, database expert, all is working fine but when i want to show it, it give error as i mentioned in post no.1
AFAIK, If the database is password protected we must provide the user and password when we call a rpt from a vb6 application
In a vb6 application We need to use some code to call and view any CR report
In your case the expert you used created it for you
Look for that code and post it
JG
... If your problem is fixed don't forget to mark your threads as resolvedusing the Thread Tools menu ...
Undermentioned code is on crystal report bydefault form:
Dim Report As New CRMonExp
Private Sub Form_Load()
Screen.MousePointer = vbHourglass
CRViewer91.ReportSource = Report
CRViewer91.ViewReport
Screen.MousePointer = vbDefault
End Sub
Private Sub Form_Resize()
CRViewer91.Top = 0
CRViewer91.Left = 0
CRViewer91.Height = ScaleHeight
CRViewer91.Width = ScaleWidth
End Sub
I m using first time crystal report bcoz there is no way to create crosstab query in datareport, so i didn't know about crystal report much but i m in trouble nd want to resolve this issue very soon. Kindly help me
Crystal Reports' report designed using OLEDB (ADO) as data source
This example demonstrates how to connect to an OLEDB (ADO) data source,
change the data source, and change the database by using the ConnectionProperty Object,
as well as how to change the table name by using the Location property of the DatabaseTable Object.
CrystalReport1 is created using an ODBC data source connected to the pubs database on
Microsoft SQL Server.
The report is based off the authors table.
Hope this helpCode:' Create a new instance of the report. Dim Report As New CrystalReport1 Private Sub Form_Load() ' Declare a ConnectionProperty object. Dim CPProperty As CRAXDRT.ConnectionProperty ' Declare a DatabaseTable object. Dim DBTable As CRAXDRT.DatabaseTable ' Get the first table in the report. Set DBTable = Report.Database.Tables(1) ' Get the "Data Source" property from the ConnectionProperties collection. Set CPProperty = DBTable.ConnectionProperties("Data Source") ' Set the new data source (server name). ' Note: You do not need to set this property if you are using the same data source. CPProperty.Value = "Server2" ' Get the "User ID" property from the ConnectionProperties collection. Set CPProperty = DBTable.ConnectionProperties("User ID") ' Set the user name. ' Note: You do not need to set this property if you are using the same user name. CPProperty.Value = "UserName" ' Get the "Password" property from the ConnectionProperties collection. Set CPProperty = DBTable.ConnectionProperties("Password") ' Set the password. ' Note: You must always set the password if one is required. CPProperty.Value = "Password" ' Get the "Initial Catalog" (database name) property from the ConnectionProperties collection. ' Note: You do not need to set this property if you are using the same database. Set CPProperty = DBTable.ConnectionProperties("Initial Catalog") ' Set the new database name. CPProperty.Value = "master" ' Set the new table name. DBTable.Location = "authors2" ' Set the report source of the viewer and view the report. CRViewer91.ReportSource = Report CRViewer91.ViewReport Screen.MousePointer = vbDefault End Sub
JG
... If your problem is fixed don't forget to mark your threads as resolvedusing the Thread Tools menu ...
I want to use your code but it give following error and terminate the application
![]()
This is a small project just to show one way to call a rpt from a vb6 app if the rpt is using a password protected db
JG
... If your problem is fixed don't forget to mark your threads as resolvedusing the Thread Tools menu ...
Thanx JG for helping me out:
It is good example when i used .mdb file (Access 2003 format) but when i want to use it with Access 2007 format .accdb then it will give error as i mentioned in post # 7.
Same example but now using Access 2007 db
JG
... If your problem is fixed don't forget to mark your threads as resolvedusing the Thread Tools menu ...
Thanx, let me check and confirm.......