Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > Crystal Reports
|
Crystal Reports General discussion about Crystal Reports. For discussions specific to the book Professional Crystal Reports for VS.NET, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Crystal Reports section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 28th, 2005, 05:16 AM
Registered User
 
Join Date: Mar 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default accessing crystal report

Hai... im using crystal report n vb 6.0. my database is access. im facing problem in displaying data in crystal report.
my code are as below:

Private Sub Command2_Click()
Dim strSQL As String

strSQL = "select ComplaintNo from ComplaintView where PersonKeyInICNo = '" & Trim(Text1.Text) & "'"

With adoComplaintView
    .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\database.mdb" & ";Mode=Read;Persist Security Info=False"
    .RecordSource = strSQL
    .CommandType = adCmdUnknown
    .Refresh
End With

With adoComplaintView.Recordset
    If Not .RecordCount = 0 Then

    g_RunReport1 Me, "Report", "Complaint Report - by Person Enter.rpt", strSQL, , , , lvFmlAry, , , True
    End If
End With
End Sub

Public Sub g_RunReport1(poform As Form, sTitles As String, _
                        sReportFile As String, _
                        sSql As String, _
                        Optional sSortField As String, _
                        Optional sSortField1 As String, _
                        Optional sSortField2 As String, Optional fml As Variant, Optional psGraphOption As String, Optional psDest As String, Optional psZoom As Boolean)
    Dim i As Integer
    Dim lsDate As Date
    On Error GoTo ErrHandler

    lsDate = Now()

    With poform.CrystalReport1
        ' Report properties Setting - Fixed
        If psDest = "P" Then
            .Destination = crptToPrinter
        Else
            .Destination = crptToWindow
        End If
        .WindowState = crptMaximized
        .DiscardSavedData = 1
        .Connect = App.Path & "\database.mdb"

        If fml(0) <> "NULL" Then
            For i = LBound(fml) To UBound(fml)
                .Formulas(i) = fml(i)
            Next i
        End If
        .WindowTitle = sTitles
        .ReportFileName = App.Path & "\Report\" & sReportFile
        .SQLQuery = sSql
        .WindowShowPrintSetupBtn = True

        If sSortField <> "" Then
            .SortFields(0) = "+" & sSortField
        End If
        If sSortField1 <> "" Then
            .SortFields(1) = "+" & sSortField1
        End If
        If IsNull(sSortField2) Then
            .SortFields(2) = "+" & sSortField2
        End If
        If IsMissing(psGraphOption) = False Then
            .GraphOptions(0) = psGraphOption
        End If
        .Action = 0

        If psZoom = False Then
            'Set Zoom level to 6 7%
            .PageZoom (67)
        End If
    End With

    Exit Sub

ErrHandler:
    If err.Number <> 0 Then
        Screen.MousePointer = 0
        MsgBox err.Number & " - " & err.Description, vbInformation, "Error"
    End If
End Sub


is there any problem with my code?
i wan to generate the report which the PersonKeyInICNo = Trim(Text1.Text). but the report generated display all the record in the ComplaintView.

pls help. thanks






Similar Threads
Thread Thread Starter Forum Replies Last Post
simple report and crystal report in vb.net saket123 .NET Framework 2.0 0 August 13th, 2008 06:55 AM
VS 2002 Crystal Report opens Seagate crystal 8 tusis_1 Crystal Reports 0 May 12th, 2007 11:45 AM
Accessing Parameter field values of sub report MyIssues_2005 Crystal Reports 0 July 14th, 2005 02:21 AM
Crystal Report sravs BOOK: Professional Crystal Reports for VS.NET 0 December 29th, 2004 04:51 AM
Error While printing report (Crystal report) vikaspaweb Pro VB 6 0 March 8th, 2004 09:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.