
Crystal data object cannot open SQL server
Hi,
Please use the code given below. I hope it'll solve your
problem
On Error GoTo hlp
Dim tbl As CRAXDRT.DatabaseTable
For Each tbl In Report.Database.Tables
tbl.SetLogOnInfo DBServer, DBDataBase, DBUser,
DBPassword
Next
Report.Database.LogOnServer "PDSSQL", DBServer,
DBDataBase, DBUser, DBPassword
regards,
jawahir
Quote:
>-----Original Message-----
>Hi,
> have generated a crystal report using crystal 8 the
report uses 4 tables
Quote:
>from the same database. They are connected using the
Microsoft SQL server
Quote:
>option in the "More Data Sources". If i try and run the
reports using the
>data object the code below fails on the crrep.preview
line. giving the
>following error
>err.number 20599
>err.description Cannot open SQL server.
>The SQLSvr.err file shows
>SQL Server Message
> Number : 18456
> State : 1
> Severity: 14
> Text : Login failed for user 'I8EPOS_Reporter'.
> Server :
>I am passing the report the same logon criteria as that
defined in the
>report, any ideas?
>Dim cr As CRPEAuto.Application
>Dim crRep As CRPEAuto.Report
>Set cr = New CRPEAuto.Application
>On Error GoTo errortrap
cr.LogOnServer "c:\windows\crystal\p2ssql.dll", "(Local)",
_
Quote:
> "I8EPOS", "I8EPOS_Reporter", "
password"
> Set crRep = cr.OpenReport(App.Path & "\Reports\" &
sRep)
> crRep.Preview sRep
> Set crRep = Nothing
> Set cr = Nothing
> Exit Function
>errortrap:
>thanks greatly in advance
>Tim B
>---
>Outgoing mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.461 / Virus Database: 260 - Release Date:
10/03/2003
>.