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

Server has not yet been opened error

Status
Not open for further replies.

Jefftopia

Programmer
Jul 30, 2002
104
US
Please excuse the detailed explanation of my problem. I am a Crystal newbie.

I am working on Vb6 and CR 8.0. I have designed a main report which is running off of several tables (i.e. when I designed the report, I opened as a Blank Report and then selected Database Files in the Data Explorer and selected Find Database Files. I then located my database and selected the tables I required for my main form).

From Vb I used the following code to call on the report:

Private Sub mnuViewCrystalReport_Click()

'Run Report.
frmRptView.Show
frmRptView.CRViewer1.ReportSource = rptWriteUp
frmRptView.CRViewer1.ViewReport

End Sub

frmRptView is a form i use to view all of my Crystal Rpts

rptWriteUp is the name of the Crystal Rpt

Everything was working fine until I added a subreport. The problem is that the subreport was not designed using the same method. I needed to use SQL in the report so instead of going into Database Files, when I designed the report, I selected Current Connections and MS Access Database.

Now when I attempt to open the report from Vb i am getting the error "server has not yet been opened"

Help Appreciated!
 
Try using coding to specify the subreport filename and record source as well. Here's an example of the subreport, the main report should already be opened first then the subreport:


myConn2.Open "DSN=ShopProMySQL"
myRS2.Source = "SELECT * FROM PartsForInvoice WHERE InvoiceNumber = 99"
Set myRS2.ActiveConnection = myConn2
myRS2.CursorLocation = adUseClient
myRS2.Open , , adOpenDynamic, adLockReadOnly

Set rptSubRpt = crxrpt.OpenSubreport("SHP_PartsForInvoice.rpt")
rptSubRpt.Database.Tables(1).SetDataSource myRS2


Aaron
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top