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!

Connect Crystal Report 4.6 to Access 2000 in VB

Status
Not open for further replies.

Shaul

Technical User
Apr 25, 2002
6
GB
Hi,

I have been battling this issue for days now so I really wish someone can help me.
I am using VB6 and have created a working crystal reports version 4.6 report.
I try to use the report from VB using this line:
Crystalreport1.Action = 1
And I keep getting the following error:
"Unable to connect: incorrect log on parameters"

I have tried numerous varietions of the crystalreport1.connect string and have not been able to solve the issue.

Please can someone just give me an example of a connect string that would log on to my Access DB (the username is "admin" and there is no password) and will finally show my bloody report.

I will REALLY appreciate some help.

Shaul
 
Try this:
Code:
lngLogOn = CrystalReport1.LogOnServer("DLLName","ServerName","DBaseName","UID","PW")

This should do the trick.
 
Hi bjrollet,

Thanx for replying but my problem is that I don't know what to put in the parameters:
"DLLNAME" (I downloaded some dll's that are appearantly needed if you want to use Access 2000 with CR4.6, I put them in win\system32 dir but don't know what to do with them). Which DllNames can i put in??
"SERVERNAME" I don't think I am using a server, I am just connecting to an Access 2000 DB. am I using a server?
What do I do if I am not using a server?

"DBaseNAME" The File of my database is named "IRMA Daily Reports.mdb" I don't really know what to put in this parameter since I am not using a server.

My problem is basically that I don't really know what I'm doing so I just hope you understand my case and can give me a specific and explicit example of a connection string that should be used in my case.

Thanks again for taking the time to reply and I really hope you could help me.

Shaul
 
Sure.

DLLName is the name of the DLL Crystal Reports is using to talk to the database. Refer to the CR help files to find the right one.

ServerName is the name of the computer that the database is on. If your computer name is "Developer1", then that is what goes here.

DBaseName is the actual name of the database.

UID is the UserID used to log in the database.

PW is the password for the UserID.
Example:
Code:
lngLogOn = CrystalReport1.LogOnServer("p2ssql.dll","Dragon","pubs,"admin","")

In the example, this will connect to a SQLServer database pubs on the server Dragon, using the UserID admin with no password.
 
I checked my machine, and my Access driver is ODBCJT32.dll. Yours may be different. Go into control panel, the DataSources and check the drivers tab. You can get the driver name there. Hope this helps
 
Hi again bjrollet,

I have tried what you told me and I get the error:
"Unable to log on to server"

I am using this line:
lngLogOn = CrystalReport1.LogOnServer("ODBCJT32.dll", "PCW10", "IRMA Daily Aborts", "Admin", "")

I had to add Dim lngLogOn because I got the error: "variable not defined" when it didn't exist.

I am using windows 2000.
I checked and the dll is ODBCJT32.dll and my pc is called PCW10.

What am I doing wrong now?

Shaul
 
Hi Again

This puts me right back in square one.
I get the same error I got at the beginning.
It just can't log on.

Don't know what to do...maybe I'll just scrap the whole crystal report and use a normal report.

Shaul
 
I'm not sure what is going wrong, but I just ran this test:

1. set up a database(Access) on my machine.
2. create a report based on the dbase.
3. create a VB app that calls the report.

The following works fine:
Code:
CrystalReport1.ReportFileName = "C:\db1_test.rpt"
CrystalReport1.Connect = "C:\db1_test.mdb"
CrystalReport1.Action = 1
 
I want to use MS access file .mdb for my crystal report but it (crystal report pro)
ask password to use it,even though *.mdb file is not password protected.
please guide me..!
 
I want to use MS access file .mdb for my crystal report but it (crystal report pro)
ask password to use it,even though *.mdb file is not password protected.
please guide me..!
 
Hi I have a question, is it possible for me to refresh the report. So when I run the report. It is the correct data.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top