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 
    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


rs.Open "SELECT * FROM report where age > 23", conn, adOpenStatic, adLockReadOnly
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.