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

Crystal from VB

Status
Not open for further replies.

sk1

Programmer
Oct 10, 2001
44
US
I have created Crystal(version 8) report which takes in Parameter value. It prompts users to select one of the months from the list then it matches this month value to the date field and opens the report showing results for that month.
Now I would like to open this report from VB 6.

It opens the form with Crystal Viewer and brings up the prompt that I created in Crystal report. But after that it gives me error of "Server Has not been open Yet"...What am I doing wrong. I have tried every thing possible I can think of. Please help me.

Here is my code..(in VB)

Public Function PrintInhouseCheckRegister() As Boolean
On Error GoTo Err_PrintInhouseCheckRegister
Dim CRApp As New CRAXDRT.Application
Dim crReport As New CRAXDRT.Report
Dim CRViewer As New CRViewer
Dim rsLetter As New ADODB.Recordset
Dim rsdelete As New ADODB.Recordset
Dim strDelete As String


PrintInhouseCheckRegister = False

Set crReport = CRApp.OpenReport(sCheckRegister)
frmCrystalViewer.Caption = "Check Register"
frmCrystalViewer.CRViewer.ReportSource = crReport
frmCreateInhouseCheck.Hide
frmCrystalViewer.Show
frmCrystalViewer.CRViewer.ViewReport
PrintInhouseCheckRegister = True


Exit_PrintInhouseCheckRegister:
Exit Function

Err_PrintInhouseCheckRegister:
MsgBox Error$ & Err
Resume Exit_PrintInhouseCheckRegister
End Function




 
You're not connecting to the database either by .LogonServer, .SetLogonInfo, or by passing an ADO recordset to the report.

 
Thanks Balves..
You are right I was not connecting to database.
SetLOngonInfo or LogonServer didnot work... but this seems to be working.


I have solved the problem by putting this line of code

crReport.Database.Tables.Item(1).SetLogOnInfo sServer, sDBName, sUserID, sPassword

-Shilpa
 
Does this approach work if you are using more than 1 table? I also could not get the SetLogonInfo to be even recognised as a valid command and the LogonServer did not work.

 
Yes, it works no matter how many tables you have.

If .SetLogonInfo is not a valid method, then perhaps you're using the OCX in your application.
 
Sorry to sound like a complete idiot balves, but how do I tell if I am using the OCX in my application and how do I change it?
 
From your other post, you're not using the OCX.

The OCX is the old method. Drop the CrystalReport control on the VB form, set the .Connect property, etc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top