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!

OCX and VB app

Status
Not open for further replies.

alan2624

Programmer
Mar 26, 2002
16
US
I have created an application in VB which uses the Crystal OCX to run and show the reports but for some reason, it will run fine on my machine which has CR8.5 installed on it but when I package the application and install it on another computer, an error message shows up to say that it is unable to open the database. I am on a W2K OS and using Access 2000.

THanks
 
Are you using an ODBC DSN to connect to Access? Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Yes I am using a DSN and the application works fine with the database but the when the report is called on, it says that it can not find the database.
 
Did you "connect" the report (in the code) to the DSN before you run it. See the connect property. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
The following is the code that is being used to run the report.
Public Sub Do_Print()
On Error GoTo StopPrinting

Crystal1.Connect = "DSN=M:\Public\Accounting\New Commissions Application\Commissions.mdb"

Crystal1.ReportFileName = "M:\Public\Accounting\New Commissions Application\" & ReportName
Crystal1.ReplaceSelectionFormula (varSelectString)
Debug.Print varSelectString
If optPrint(0).Value = False Then
Crystal1.Destination = crptToWindow
Crystal1.Action = 0
Else
Crystal1.Destination = crptToPrinter
Crystal1.Action = 1
End If

Call ResetForm

Exit Sub
StopPrinting:
If Err.Number = "20545" Then
MsgBox "Printing Stopped by User", vbOKOnly + vbCritical, "Printer Stopped"
Else
MsgBox "Another error has occurred. Please Inform Alan" & Err.Number & " " & Err.Description

End If
Call ResetForm
End Sub

In a previous version of the application that I had written with an Access 97 database, and CR7.0. I did not need the connection string and the reports ran fine. I was wondering if there is anything different because of Access 2000 or CR8.5

Thanks.
 
If you are using ODBC, then you aren't using the correct syntax for your Connect. The arguments for the connect property are the ODBC connectin name (DSN) , user ID and password - not a path. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top