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!

SCR Automation Logon with OLE report problem

Status
Not open for further replies.

KPharm

Programmer
Feb 1, 2001
38
US
I can get the following Logon line to execute ok with a report that was done in ODBC with the following:

Dim crystalApplication As CRPEAuto.Application
Dim crystalReport As CRPEAuto.Report
Set crystalApplication = CreateObject("Crystal.CRPE.Application")
Call crystalApplication.LogOnServer("P2SODBC.DLL", "Oracle 8", "ServerA", m_sUsername, m_sPassword)

(where "Oracle 8" is the name of the ODBC, "ServerA" is the Oracle server name.)

but I can not get an OLE-made report to get past this line:

Call crystalApplication.LogOnServer("P2SOLEDB.DLL", "ServerA", , m_sUsername, m_sPassword)

Is it possible to have both types of reports to work in the same manner as I'm trying? I like using this method because it's giving me full control of the print properties - *including* orientation!

Thanks
 
I got the following to work in the code but bombs out during the displaying of the Preview:

Dim crystalApplication As CRPEAuto.Application
Dim crystalReport As CRPEAuto.Report
Dim nTableCount as integer
Set crystalApplication = CreateObject("Crystal.CRPE.Application")
Set crystalReport = crystalApplication.OpenReport(m_sReportName5)

For nTableCount = 1 To crystalReport.Database.Tables.Count
crystalReport.Database.Tables(nTableCount).SetLogOnInfo m_sServer, , m_sUsername, m_sPassword
Next

Call crystalReport.SelectPrinter(Printer.DriverName, Printer.DeviceName, Printer.Port)

If frmPrinter.m_bPortrait Then
crystalReport.PageSetup.PaperOrientation = crPortrait
Else
crystalReport.PageSetup.PaperOrientation = crLandscape
End If

crystalReport.Preview ' Error: 20599 Cannot open SQL Server
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top