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

What am i missing? 1

Status
Not open for further replies.

JHerr

Programmer
May 25, 2001
42
US
I have an app that prints out reports at a specific time. when i started it, i just had it print a generic .rpt file with a "Hello World!" text message, and everything went fine. then i created a real report, based on an access query that returns all the fields from a table matching an ID field, your basic Select * From _ Where ID=""
Well now it gives me a "runtime error 20599: cannot open SQL server" which i believe has to do with the fact that the report needs to logon to the db to use the query. but i've tried several different appoaches :
CR1.Connect= "DSN=#MyDSN#;UID=admin;PWD=;DSQ=#myDB#"
CR1.DataFiles(0) = "Proc(MyQuery)"

OR

CR1.LogOnServer "{Microsoft Access Driver (*.mdb)}", "#MyDSN#", "#myDBPath#", "admin", ""

^^this one gives me a "cannot logon to server" error

my question is...what am i NOT doing, is it a real simple line, or what...i've seen other code,long code, that avoids using the ocx all together, but i like using it. I appreciate any help you guys can give me, as this is a rather time sensitive matter.
Thanks!!
-jacob

Details:
CR8.5; VB6; CR Control; ODBC(?);
 
I've seen this same message 'Cannot open SQL server' and the like. If you're setting the log-on information correctly then the next port of call would be to check if the client machine has the appropriate DLL's such that the database connection can be made. The list of dll's as required can be found in the 'RunTime.hlp' file within the Crystal Reports directory.
I hope this leads you to a solution.
Steve
 
Perhaps you could give me an example of a correct log-on to an Access2000 db? i probably have an error there. its certainly appreciate a push in the right direction.
 
JHerr,
Not sure exactly about the logging onto Access databases - I have applications using Delphi 5 that log-on to SQL Server 7.0 database tables successfully (after much trial and error). Beyond the logging of the report onto the database itself - I think it's also a case of indicating the location of each of the tables included in the report. I'm guessing your error lies when you transfer the report to a machine other than that which it was developed on ?
I have to step through each of the tables and indicate the location of the table - in my case it would be something like 'database-name.dbo.table-name' but in the case of Access I would guess it's a case of indicating the path of the database itself where the tables are stored.
Try cycling through the tables included in the report and indicate the location of each :
CRReport.Database.Tables[x].Location := 'database-name.dbo.table-name' - I'm unsure whether this is an essential...
You may also need to set the log-on info for each of the tables :
CRReport.Database.Tables[x].SetLogOnInfo(ODBCConnection, DatabaseName, user-name, password).
Can't recall the exact syntax in these cases I'm afraid.
I hope that this gets you off the ground or triggers someone else to fill in the blanks ....
Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top