Recordset is not effecting my report? Help

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Sep 2004
Posts: 33
Reputation: letmec is an unknown quantity at this point 
Solved Threads: 2
letmec's Avatar
letmec letmec is offline Offline
Light Poster

Recordset is not effecting my report? Help

 
0
  #1
Apr 7th, 2006
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.


Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Dim conn As ADODB.Connection 'CONNECTION TO BROKER QUERIES
  2. Dim rs As ADODB.Recordset 'HOLDS ALL DATA RETURNED FROM QUERY
  3. Dim crystal As CRAXDRT.Application 'LOADS REPORT FROM FILE
  4. Dim report As CRAXDRT.report 'HOLDS REPORT
  5.  
  6. CRViewer.DisplayBorder = False 'MAKES REPORT FILL ENTIRE FORM
  7. CRViewer.DisplayTabs = False 'THIS REPORT DOES NOT DRILL DOWN, NOT NEEDED
  8. CRViewer.EnableDrillDown = False 'REPORT DOES NOT SUPPORT DRILL-DOWN
  9. CRViewer.EnableRefreshButton = False 'ADO RECORDSET WILL NOT CHANGE, NOT NEEDED
  10.  
  11. Set conn = New ADODB.Connection
  12.  
  13. 'Assuming that connection is established
  14. conn.Open 'THESE OPTION VALUES ARE BEST FOR VB
  15.  
  16.  
  17. Set rs = New ADODB.Recordset
  18. rs.Open "SELECT * FROM report", conn, adOpenStatic, adLockReadOnly
  19.  
  20. Set crystal = New CRAXDRT.Application 'MANAGES REPORTS
  21.  
  22. Set report = crystal.OpenReport(App.Path & "report1.rpt") 'OPEN OUR REPORT
  23.  
  24. report.DiscardSavedData 'CLEARS REPORT SO WE WORK FROM RECORDSET
  25. report.Database.SetDataSource rs 'LINK REPORT TO RECORDSET
  26.  
  27. CRViewer.ReportSource = report 'LINK VIEWER TO REPORT
  28. CRViewer.ViewReport 'SHOW REPORT
  29.  
  30. Do While CRViewer.IsBusy 'ZOOM METHOD DOES NOT WORK WHILE
  31. DoEvents 'REPORT IS LOADING, SO WE MUST PAUSE
  32. Loop 'WHILE REPORT LOADS.
  33.  
  34. CRViewer.Zoom 94
  35.  
  36. rs.Close 'ALL BELOW HERE IS CLEANUP
  37. Set rs = Nothing
  38.  
  39. conn.Close
  40. Set conn = Nothing
  41.  
  42. Set crystal = Nothing
  43. Set report = Nothing
  44. End Sub
  45.  
  46. Private Sub Form_Resize() 'MAKE SURE REPORT FILLS FORM
  47. CRViewer.Top = 0 'WHEN FORM IS RESIZED
  48. CRViewer.Left = 0
  49. CRViewer.Height = ScaleHeight
  50. CRViewer.Width = ScaleWidth
  51.  
  52.  
  53.  
  54.  
  55.  
  56. '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
Last edited by Comatose; Apr 7th, 2006 at 6:33 pm. Reason: Code Tags
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 187
Reputation: aparnesh is an unknown quantity at this point 
Solved Threads: 10
aparnesh's Avatar
aparnesh aparnesh is offline Offline
Junior Poster

Re: Recordset is not effecting my report? Help

 
0
  #2
Apr 8th, 2006
use
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. rs.Open "SELECT * FROM report where age > 23", conn, adOpenStatic, adLockReadOnly
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC