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!

Getting error when using LogOnServer Method

Status
Not open for further replies.

agersh

Programmer
May 8, 2003
12
US
WindowsXP Pro, VB 6, MSSQL Server 2000, Crystal Reports 9

I have a report, which includes a subreport. I receive the following error when I use the LogOnServer method to log the main and subreport into my MS SQL2000 database. Any ideas why am I getting this error?

Error -2147189176 – Logon failed.
Details: IM002:[Microsoft][ODBC Driver Manage] Data source name not found and no default driver specified

Sample Code:
Dim CRXApplication As CRAXDRT.Application
Dim MainReport As CRXDRT.Report
Dim SubReport As CRAXDRT.Report
Set CRXApplication = CreateObject("CrystalRuntime.Application")
Set CRXReport = CRXApplication.OpenReport(App.Path & "\Reports\ClaimDetail_tst.rpt", 1)
Set Subreport = CRXReport.OpenSubreport("AssociatedCoverages.rpt")
Call CRXReport.Database.LogOnServer("P2SODBC.DLL", "DEVSERVER", "DB1", "id", "password")
Call Subreport.Database.LogOnServer("P2SODBC.DLL", "DEVSERVER", "DB1", "id", "password")

P.S. I also get this error when a change "P2SODBC.DLL" to "PDSODBC.DLL".
 
It seems there is a problem with logon server on the database better try the logon method on the tables. it seems to work ok.
for eg:

Set CrxReport = CrxApplication.OpenReport(App.Path & "\rptSRCLST.rpt")

For i = 1 To CrxReport.Database.Tables.Count
CrxReport.Database.Tables(i).Location = App.Path
CrxReport.Database.Tables(i).SetLogOnInfo "sql server", App.Path & "\mydatabase", "usernm", "password"
Next
'where the mydatabase is the name of the database
'usernm is the username
'password is the password set for the database

CrxReport.DiscardSavedData
CrxReport.Database.SetDataSource rs

CRV.ReportSource = CrxReport
' View the report in the CrViewer
CRV.ViewReport

While CRV.IsBusy
DoEvents
Wend

hope it helps

Harshu.

U can also try to use Active data and field definitions (ttx) files that way u donot need logon or anything
as u r only passing the recordset to the report.





 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top