Skip to Content
0
Former Member
Feb 05, 2009 at 11:37 AM

Problem connection to database when opening Crystal Report in VB6 app

393 Views

Hi all, first post, so be gentle!

I've developed a simple app and database using VB6 and SQL Server 2005 and is seems to be working well when i test it.

Problem i have is after i installed the app on another PC. When the user tries to open the report they get an error when the report tries to connect to the database. It appears the report is trying to connect to the SQL Server using the user's AD account details, yet i set the report up with a trusted connection. I created a replica ODBC connection (as used by me when designing the report) on the users PC to see if that was what was missing. THis was set up to use the generic SQL Server logon details. Unfortubately the report is still trying to connect with the user's AD details.

I had a bash at creating the VB commands to set the connection settings, but i couldn't get this to work.

If anyone can help point me in the right direction or show me the correct code/steps to get th connection details correct, i'd be very grateful.

Here is the code i have in my app:

(Form1)

Dim crxApplication As New CRAXDRT.Application

Public Report As CRAXDRT.Report

Private Sub cmdRunReport_Click()

ReportPath = App.Path & "\" & File1.FileName

If (File1.FileName = "SKU MTM Report - ADR.rpt" Or File1.FileName = "SKU MTM Report - BS100.rpt") Then

Set Report = crxApplication.OpenReport(ReportPath, 1)

Report.ParameterFields.Item(1).AddCurrentValue (Trim(DataCombo1.Text))

Report.ParameterFields.Item(2).AddCurrentValue (Trim(DataCombo2.Text))

Report.ParameterFields.Item(3).AddCurrentValue (Trim(DataCombo3.Text))

End If

frmreports2.Show

End Sub

(Form2 with Crystal ActiveX Viewer component)

Private Sub Form_Load()

CrystalActiveXReportViewer1.ReportSource = frmReports.Report

CrystalActiveXReportViewer1.ViewReport

End Sub

Thanks in advance for any advice!

Edited by: James McCaig on Feb 5, 2009 12:39 PM