Results 1 to 4 of 4

Thread: Report

  1. #1
    champgary
    Guest

    Post Report

    hello,
    Does anybody know how to create report weekly , monthly using crystal report
    Like i will select date from and date to and it will show output as per date, I know it can done using parameter field but anyother way,
    Or anybody knows using sql
    Thanx in advance
    Gary

  2. #2
    Frenzied Member zuperman's Avatar
    Join Date
    Dec 2000
    Location
    Portugal
    Posts
    1,033
    Perhaps this helps:
    VB Code:
    1. ' *************************************************************
    2. ' Purpose:  Demonstrate new methods of adding ADO connections to reports
    3. '           (New to Crystal Reports 8.0)
    4. '
    5. '           There are two new methods that provide a convenient
    6. '           way to add ADO data sources to a report:
    7. '           1.) AddADOCommand takes as parameters an active ADO connection
    8. '           and an ADO command object.  In this example, a new connection
    9. '           is created to a database, and the resulting recordset is assigned
    10. '           at runtime to the report
    11. '           2.) AddOLEDBSource takes as parameters the name of an active
    12. '           ADO connection and the name of a table that can be accessed
    13. '           through that connection.  In this example, the connection set
    14. '           up through the VB Data Environment is used as a data source.
    15. '
    16. '           Both methods can be used with either the VB Data Environment
    17. '           or another data source created at runtime.
    18. '           Notice in the Crystal Report design environment that there is
    19. '           no data source attached to the report at design time.
    20. '
    21. Option Explicit
    22.  
    23. Dim m_Report As New CrystalReport1
    24.  
    25. ' The ADO connection to the local database.
    26. Dim cnn1 As ADODB.Connection
    27. Dim datcmd1 As ADODB.Command
    28.  
    29. ' *************************************************************
    30. ' Demonstrate the use of AddADOCommand by opening an ADO data command,
    31. ' adding the data source to the report, and then adding a field
    32. ' to the report that uses that data source.
    33. '
    34. Private Sub cmdADO_Click()
    35.     Dim fld As FieldObject
    36.     Dim strCnn As String
    37.    
    38.     ' Open the data connection
    39.     Set cnn1 = New ADODB.Connection
    40.     strCnn = "Provider=MSDASQL;Persist Security Info=False;Data Source=Xtreme Sample Database;Mode=Read"
    41.     cnn1.Open strCnn
    42.  
    43.     ' Create a new instance of an ADO command object
    44.     Set datcmd1 = New ADODB.Command
    45.     Set datcmd1.ActiveConnection = cnn1
    46.     datcmd1.CommandText = "Customer"
    47.     datcmd1.CommandType = adCmdTable
    48.  
    49.     ' Add the datasource to the report
    50.     m_Report.Database.AddADOCommand cnn1, datcmd1
    51.     ' Add a new field object to the report and set the field object to use
    52.     ' the new data source.
    53.     Set fld = m_Report.Section3.AddFieldObject("{ado.Customer Name}", 0, 0)
    54.     LoadReport
    55. End Sub
    56.  
    57. ' *************************************************************
    58. ' Demonstrate the use of AddOLEDBSource by opening an ADO data source,
    59. ' adding the data source to the report, and then adding a field
    60. ' to the report that uses that data source.  In this example, the
    61. ' OLEDB source in the VB Data Environment is used
    62. '
    63. Private Sub cmdOLEDB_Click()
    64.     Dim fld As FieldObject
    65.    
    66.     ' Add the datasource to the report
    67.     m_Report.Database.AddOLEDBSource DataEnvironment1.Connection1, "Customer"
    68.     ' Add a new field object to the report and set the field object to use
    69.     ' the new data source.
    70.     Set fld = m_Report.Section3.AddFieldObject("{Customer.Customer Name}", 0, 0)
    71.     LoadReport
    72. End Sub
    73.  
    74. ' *************************************************************
    75. ' Load the Report in the viewer
    76. '
    77. Private Sub LoadReport()
    78.     Screen.MousePointer = vbHourglass
    79.     CRViewer1.ReportSource = m_Report
    80.     CRViewer1.ViewReport
    81.     Screen.MousePointer = vbDefault
    82.     cmdOLEDB.Enabled = False
    83.     cmdADO.Enabled = False
    84. End Sub
    85.  
    86. ' *************************************************************
    87. Private Sub cmdAbout_Click()
    88.     frmAbout.Show vbModal
    89. End Sub
    90.  
    91. ' *************************************************************
    92. Private Sub cmdExit_Click()
    93.     Unload Me
    94. End Sub

    Regards...
    Help keep this forum clean: Remember to mark your thread as resolved · Search before you post · Remember to rate posts that help

    VS2010: Visual Studio 2010 Keybinding Posters
    · Service Pack 1
    Tools: GhostDoc - automatically generates XML documentation comments
    · NuGet package Manager · PowerCommands IDE extensions
    Source Control: ankhsvn - integration for SVN
    · Windows Shell Extension for Subversion

    Development Laptop: Intel Core i5 430M 2.26 GHz @ 2.53 GHz
    · 4096 MB, DDR3 PC3-8500F (533 MHz), Kingston · ATI Mobility Radeon HD 5470 · 15.6 @ 16:9, 1366x768 pixel, HD LED LCD

    I follow:
    JoelOnSoftware - A weblog by Joel Spolsky, a programmer working in New York City, about software and software companies
    ScottGu's Blog - Scott Guthrie works for Microsoft as the Product Manager of the .NET Framework
    Portugal-a-Programar - Portuguese Developers Community
    .NET Rocks! - is a weekly Internet audio talk show for .NET Developers.

    Programming Languages:
    C#
    · VB.NET · JAVA · PHP · Javascript
    Other:
    XML
    · HTML · CSS · JQuery · SQL



    *** Proudly Portuguese ***

  3. #3
    Frenzied Member zuperman's Avatar
    Join Date
    Dec 2000
    Location
    Portugal
    Posts
    1,033
    here it goes the full project
    Attached Files Attached Files
    Help keep this forum clean: Remember to mark your thread as resolved · Search before you post · Remember to rate posts that help

    VS2010: Visual Studio 2010 Keybinding Posters
    · Service Pack 1
    Tools: GhostDoc - automatically generates XML documentation comments
    · NuGet package Manager · PowerCommands IDE extensions
    Source Control: ankhsvn - integration for SVN
    · Windows Shell Extension for Subversion

    Development Laptop: Intel Core i5 430M 2.26 GHz @ 2.53 GHz
    · 4096 MB, DDR3 PC3-8500F (533 MHz), Kingston · ATI Mobility Radeon HD 5470 · 15.6 @ 16:9, 1366x768 pixel, HD LED LCD

    I follow:
    JoelOnSoftware - A weblog by Joel Spolsky, a programmer working in New York City, about software and software companies
    ScottGu's Blog - Scott Guthrie works for Microsoft as the Product Manager of the .NET Framework
    Portugal-a-Programar - Portuguese Developers Community
    .NET Rocks! - is a weekly Internet audio talk show for .NET Developers.

    Programming Languages:
    C#
    · VB.NET · JAVA · PHP · Javascript
    Other:
    XML
    · HTML · CSS · JQuery · SQL



    *** Proudly Portuguese ***

  4. #4
    champgary
    Guest
    Hey zuperman..
    Wow
    Thanx a lot
    Now i will fight with it,
    Gary

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width