Crystal Report
-
Hi I need to know the Crystal report4.6 and 9 and 10 code to display the report from VB6 actually i have wrote the below code and it displays the report but not results is not right however it was right when i was designing the report the code is
Dim cn1 As New ADODB.Connection
cn1.Open ("provider=SQLOLEDB;server=CAI-MAGEDH-DT;database=Att;user id=-;pwd=-")
cn1.Execute "drop view CAR"
cn1.Execute "Create View CAR as SELECT Badgeholder ,Count(DISTINCT bdate) as Days ,9 as rate, Count(DISTINCT bdate) * 9 as Total from Newatt n inner join Bnames b on n.badgeholder = b.Snames group by badgeholder"
Dim reportfile As New CRAXDRT.Application
If cn.State = 1 Then cn.Close
If rs.State = 1 Then rs.Close
cn.Open ("provider=SQLOLEDB;server=CAI-MAGEDH-DT;database=Att;user id=-;pwd=-")
rs.ActiveConnection = cn
rs.CursorType = adOpenKeyset
rs.LockType = adLockOptimistic
rs.Source = "SELECT * FROM NewAtt"
rs.Open
Dim reports As report
Set report = reportfile.OpenReport(App.Path & "/car1.rpt")
report.Database.SetDataSource rs
Form2.CRViewer91.ReportSource = report
Form2.CRViewer91.EnableExportButton = True
Form2.CRViewer91.DisplayGroupTree = False
Form2.CRViewer91.EnableProgressControl = True
Form2.CRViewer91.EnableProgressControl = True
Form2.CRViewer91.ViewReport
Form2.CRViewer91.Zoom 1
Form2.Show
-
Hi I need to know the Crystal report4.6 and 9 and 10 code to display the report from VB6 actually i have wrote the below code and it displays the report but not results is not right however it was right when i was designing the report the code is
Dim cn1 As New ADODB.Connection
cn1.Open ("provider=SQLOLEDB;server=CAI-MAGEDH-DT;database=Att;user id=-;pwd=-")
cn1.Execute "drop view CAR"
cn1.Execute "Create View CAR as SELECT Badgeholder ,Count(DISTINCT bdate) as Days ,9 as rate, Count(DISTINCT bdate) * 9 as Total from Newatt n inner join Bnames b on n.badgeholder = b.Snames group by badgeholder"
Dim reportfile As New CRAXDRT.Application
If cn.State = 1 Then cn.Close
If rs.State = 1 Then rs.Close
cn.Open ("provider=SQLOLEDB;server=CAI-MAGEDH-DT;database=Att;user id=-;pwd=-")
rs.ActiveConnection = cn
rs.CursorType = adOpenKeyset
rs.LockType = adLockOptimistic
rs.Source = "SELECT * FROM NewAtt"
rs.Open
Dim reports As report
Set report = reportfile.OpenReport(App.Path & "/car1.rpt")
report.Database.SetDataSource rs
Form2.CRViewer91.ReportSource = report
Form2.CRViewer91.EnableExportButton = True
Form2.CRViewer91.DisplayGroupTree = False
Form2.CRViewer91.EnableProgressControl = True
Form2.CRViewer91.EnableProgressControl = True
Form2.CRViewer91.ViewReport
Form2.CRViewer91.Zoom 1
Form2.Show
-
First i'd like to thank you for you reply but i kow this option and i have already unchecked it with no avail the problem that when i run the RPT file it works good but when it run under VB through code it displays the report in wrong way is it because i did inner join in my SQL Statement?