I got it to work! I simply used the logon method as described here and it works fine.
> > the Tables object rather than the LogonServer method.
> > 'Sample Code for SetLogonInfo:
> > Report.Database.Tables(1).SetLogOnInfo "server", _
> > "database", "UID", "PWD"
> Hi Gary,
> Since I posted this I have started using reports within VB and also found out that
> that the reports must use the SQL Server driver to work within VB (otherwise you
> get the "Server not yet opened" message). I had written the reports with an ODBC
> driver.
> To change the driver, open up the Crystal Report. Go to the Database Menu and
> Choose 'Convert Database Driver'.
> Then change the option to pdssql(SQLServer). You then have to enter server name
> and user_ID and password. This must also be done for any subreports you have. For
> this change to take effect, you must then run the report to refresh the change.
> If you have written the report using a query, the 'Convert Database Driver' option
> will not be available to you. I don't know if there's a workaround for this. I
> ended up rewriting the reports.
> My code looks something like below. I need to change the table name because I am
> working in a Dev environment, but within Crystal I set the database name to Prod.
> Let me know how you get on.
> I need to make a new package for the end users and have a problem now where in the
> EXE, when I try to go into a Crystal Report, I'm booted out of the application. If
> you are up to this stage and have any ideas why, please let me know.
> Thanks,
> Nicola
> Private Sub DisplayReport(ReportName As String, SelectCriteria As String)
> Dim strConn As String
> Dim Table As String
> Dim ItemNumber As Integer 'counter to loop through report tables
> 'Populate the Report Object with the desired report file
> Set CrApp = New CRAXDRT.Application
> Set CrRep = CrApp.OpenReport(App.Path & "\" & ReportName)
> 'Loop through all database tables and set the correct server & database
> ItemNumber = 1
> Set tbls = CrRep.Database.Tables
> For Each tbl In tbls
> tbl.SetLogOnInfo Server, Database, UserName, Password
> 'Pass database owner & table name
> 'Need to cut default location string so can insert proper table name in
> front
> Table = Right(CrRep.Database.Tables.Item(ItemNumber).Location,
> (Len(CrRep.Database.Tables.Item(ItemNumber).Location) - InStr(1,
> CrRep.Database.Tables.Item(ItemNumber).Location, ".")))
> tbl.Location = Database & "." & Table
> ItemNumber = ItemNumber + 1
> Next tbl
> 'Open connection string
> Set cn = New ADODB.Connection
> strConn = objUserConnection.GetConnectionString & ";User ID=" & UserName &
> ;Password=" & Password
> cn.Open strConn
> 'Send the report object to the Crviewer and view the report.
> frmCrystalReportDisplay.CrystalViewer.ReportSource = CrRep
> frmCrystalReportDisplay.CrystalViewer.ViewReport
> If cboMarketingReports.Visible Then
> frmCrystalReportDisplay.Caption = cboMarketingReports.BoundText
> ElseIf cbobFinanceReports.Visible Then
> frmCrystalReportDisplay.Caption = cbobFinanceReports.BoundText
> End If
> Me.Hide
> frmCrystalReportDisplay.Show
> End Sub
> > Thank you very much - I will try this today.
> > Gary
> > > Hi Gary,
> > > The following is directly from the Seagate website about this problem.I
> > > haven't tried it myself.
> > > Nicola
> > > This error message is a result of using the LogonServer
> > > method with
> > > OLE DB. This issue has been tracked and given Track ID
> > > 15254.
> > > The workaround is to use the SetLogonInfo method from
> > > the Tables
> > > object rather than the LogonServer method.
> > > 'Sample Code for SetLogonInfo:
> > > Report.Database.Tables(1).SetLogOnInfo "server",
> > > "database", "UID",
> > > "PWD"
> > > Note===========
> > > This issue is not unique to the RDC. If you use the
> > > equivalent of the
> > > LogonServer method and OLE DB with other Crystal Report
> > > Development tools, you will also receive an error.
> > > To successfully connect to OLE DB:
> > > For Crystal Report Print Engine calls (Crpe32.dll),
> > > use PESetNthTableLogonInfo.
> > > Crystal Active X Control (Crystl32.ocx), use
> > > Logoninfo.
> > > Crystal Report Automation Server (Cpeaut32.dll), use
> > > Setlogoninfo.
> > > Crystal Visual Component Library (VCL), use Logoninfo.
> > > > I am trying to use an existing .rpt file that works fine outside of VB6
> > > > connecting to SQL7. When I try to open the .rpt in my new VB6
> > > > application, I get the error message when I open the report form. I have
> > > > tried resetting the location in the CrystalReport1 designer but still
> > > > get the error when running the application. Do I need to re-establish
> > > > the database connection trough code in the report form?