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

Crystal Reports in VB6 app 1

Status
Not open for further replies.

atruhoo

Programmer
Jan 8, 2003
131
US
I know this is a simple question but this is first time using Crystal Reports much less in VB app. Users had been using Discoverer reports and now want to be able to creat/view reports in app itself thus the adventure I have undertaken. In Crystal Reports I can get the report to show data in report. However when I try to add and open in VB6 app I get error that states something like 'Server not connected'. Does anyone know of tutorial or feels like offering advice on what I need to do to get started on the right path.

Thanks
Richard
 
Thanks for the info it appears to be helpful. Will let you know how it goes. A star for your effort.
 
pgtek

Able to create and view reports where save data in report using OCX however if save report with option of not saving data to report in an attempt to make the reports dynamic. I get unable to connect to SqlServer though am using Oracle DB. Heres my code any help you can give I would appreciate.

Dim WithEvents CrystalReport1 As CrystalReport
Dim WithEvents cmdPrint As CommandButton

Private Sub cmdPrint_Click()
CrystalReport1.ReportFileName = "C:\Documents and Settings\rstacy\Desktop\Report1.rpt"
CrystalReport1.Action = 1
End Sub

Private Sub Form_Load()
Set CrystalReport1 = Controls.Add("Crystal.CrystalReport", "CrystalReport1")
Set cmdPrint = Controls.Add("VB.CommandButton", "cmdPrint")
cmdPrint.Move 1500, 1500
cmdPrint.Caption = "Test"
cmdPrint.Visible = True
End Sub

Private Sub Form_Unlaod(Cancel As Integer)
Set CrystalReport1 = Nothing
Set cmdPrint = Nothing
End Sub

Richard
 
hi
your not passing the set logon info thats why

check this link above

pgtek
 
Thanks for your reply pgtek got working last week ended up going with recordset example found on link you provided. Solution provided below for other newbies to Crystal & VB. Will lookat doing with OCX later. Once again thanks for help.

Set oraConn = New ADODB.Connection
Set oraRst = New ADODB.Recordset
oraConn.Open "Provider=MSDAORA.1;User ID=****;Data Source=****;password=*****;Persist Security Info=False"
Sql = "Select * from ParkingLot"
oraRst.ActiveConnection = oraConn

oraRst.Open Sql

crxRep.Database.SetDataSource oraRst
CRViewer1.ReportSource = crxRep
CRViewer1.ViewReport

--Actually passed in connection globally in final production
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top