954,551 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Recordset is not effecting my report? Help

Hello,
I am using VB6.0 and crystal report8.5. my problem is that my report is not behaving dynamically. Iam using MS-ACCESS database.

Some of my may help you figure out.

Dim conn As ADODB.Connection            'CONNECTION TO BROKER QUERIES 
    Dim rs As ADODB.Recordset               'HOLDS ALL DATA RETURNED FROM QUERY 
    Dim crystal As CRAXDRT.Application      'LOADS REPORT FROM FILE 
    Dim report As CRAXDRT.report            'HOLDS REPORT 
     
    CRViewer.DisplayBorder = False          'MAKES REPORT FILL ENTIRE FORM 
    CRViewer.DisplayTabs = False            'THIS REPORT DOES NOT DRILL DOWN, NOT NEEDED 
    CRViewer.EnableDrillDown = False        'REPORT DOES NOT SUPPORT DRILL-DOWN 
    CRViewer.EnableRefreshButton = False    'ADO RECORDSET WILL NOT CHANGE, NOT NEEDED 
     
    Set conn = New ADODB.Connection 

'Assuming that connection is established 
conn.Open                                   'THESE OPTION VALUES ARE BEST FOR VB 
     
     
    Set rs = New ADODB.Recordset 
    rs.Open "SELECT * FROM report", conn, adOpenStatic, adLockReadOnly 
     
    Set crystal = New CRAXDRT.Application           'MANAGES REPORTS 
     
    Set report = crystal.OpenReport(App.Path & "report1.rpt")  'OPEN OUR REPORT 
     
    report.DiscardSavedData                      'CLEARS REPORT SO WE WORK FROM RECORDSET 
    report.Database.SetDataSource rs             'LINK REPORT TO RECORDSET 
     
    CRViewer.ReportSource = report              'LINK VIEWER TO REPORT 
    CRViewer.ViewReport                         'SHOW REPORT 
     
    Do While CRViewer.IsBusy              'ZOOM METHOD DOES NOT WORK WHILE 
        DoEvents                          'REPORT IS LOADING, SO WE MUST PAUSE 
    Loop                                  'WHILE REPORT LOADS. 
     
    CRViewer.Zoom 94 
     
    rs.Close                            'ALL BELOW HERE IS CLEANUP 
    Set rs = Nothing 
     
    conn.Close 
    Set conn = Nothing 
     
    Set crystal = Nothing 
    Set report = Nothing 
End Sub 
 
Private Sub Form_Resize()               'MAKE SURE REPORT FILLS FORM 
    CRViewer.Top = 0                    'WHEN FORM IS RESIZED 
    CRViewer.Left = 0 
    CRViewer.Height = ScaleHeight 
    CRViewer.Width = ScaleWidth 





'End of Code


Here in my application when i launch report all the records all displayed
I want to have records where age>23

Help me this is my first commercial project

letmec
Light Poster
33 posts since Sep 2004
Reputation Points: 10
Solved Threads: 2
 

use

rs.Open "SELECT * FROM report where age > 23", conn, adOpenStatic, adLockReadOnly
aparnesh
Junior Poster
194 posts since Jul 2005
Reputation Points: 20
Solved Threads: 10
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You