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

Crystal Reports + VB + SQL Server

Status
Not open for further replies.

sgf323

Programmer
Jun 28, 2002
3
0
0
US
I built my reports in Crystal Reports then imported them to VB into the RDC. I used to use an Access database and to set the database location for the RDC I used this code:

Code:
For I = 1 To Report.Database.Tables.Count
    Report.Database.Tables.Item(I).Location = SourceFile 'SourceFile holds the location of the Access database
Next I

I have now changed over to SQL Server 2000 but nothing I do will allow me to link my reports to the SQL Server database!

I tried adding the Crystal Reports control to the form and this code:
WEBSERVER is the name of the server with SQL running on it
AMSTRACKINGSQL is the name of the database in SQL Server.

Code:
crpReport.Connect = "DSN =WEBSERVER;UID = sa;PWD =ams;DSQ =AMSTRACKINGSQL"
crpReport.ReportFileName = App.Path & "\reports\new_nurseprofit.rpt" 
crpReport.Action = 1

When running that code it stops at "crpReport.Action=1" with the error message "Unable to open database"

I also tried to use report.Database.LogOnServer but I couldn't get that to work either!

I also tried making a DSN called AMSTRACKING and used:
Code:
crpReport.Connect = "DSN =AMSTRACKING;UID = sa;PWD =ams"
crpReport.ReportFileName = App.Path & "\reports\new_nurseprofit.rpt" 
crpReport.Action = 1

But nothing!

please help! thanks

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top