Hi! I was told to use DSN for crystal report so that I can access or view my report from vb6. I tried creating system dsn and when i run my app i get this error "Logon Failed. Details:IM002:[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified." But when I open the report to crystal report viewer it will ask me for the datasource first before it will display the result. What am I missing here?
here's my code:
Code:Public Sub openConnection() Set oConn = New ADODB.Connection With oConn .Provider = "SQLOLEDB" .CursorLocation = adUseClient .Properties("Data Source").Value = ".\SQLEXPRESS" .Properties("Initial Catalog").Value = "InvtyDB" .Properties("Integrated Security").Value = "SSPI" .ConnectionTimeout = 30 .Open End With End SubCode:Option Explicit Dim cReport As CRAXDRT.Report Dim Appn As New CRAXDRT.Application Dim sSQL As String Dim sSQL1 As String Dim rsTemp As ADODB.Recordset Private Sub cmdDisplay_Click() Screen.MousePointer = vbHourglass Set Appn = CreateObject("CrystalRunTime.Application") Set cReport = Appn.OpenReport(App.Path & "\InvtyReport.rpt") CRViewer91.ReportSource = cReport cReport.ParameterFields(1).AddCurrentValue MonthName(Month(DTPStart.Value)) cReport.ParameterFields(2).AddCurrentValue CStr(DTPStart.Year) ' cReport.ParameterFields(3).AddCurrentValue (DTPStart.Value) ' cReport.ParameterFields(4).AddCurrentValue (DTPEnd.Value) CRViewer91.ViewReport Screen.MousePointer = vbDefault End Sub Private Sub Form_Unload(Cancel As Integer) Set cReport = Nothing Set Appn = Nothing End Sub


Reply With Quote