Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2006
    Posts
    3

    Unanswered: Changing Header in Crystal Reports

    hi,
    im new to crystal reports integration with vb.net
    i have made an interface to use different selection formulas for various conditions and i want my report header to be changed accordingly

    for example if i have selected the sales report from 1st september to 30th september then
    the header should be

    "SALES REPORT FROM 1ST SEPTEMBER TO 31ST SEPTEMBER"

  2. #2
    Join Date
    Dec 2004
    Location
    Connecticut
    Posts
    85
    You could create a text field and then drop the parameter fields into it, if they are formatted to your liking.

    Or you can set the Report_Header_Text to be a calculated field, using something like "Sales Orders between "+ {?StartDate}" and "{?EndDate}. You can include any necessary formatting of the parameters as part of the calculated field.

  3. #3
    Join Date
    Sep 2006
    Posts
    3
    im using the following code
    from vb.net
    Code:
    Dim m_tmpFrom As String = Me.m_DateTimeFrom.Value.Month & "/" & Me.m_DateTimeFrom.Value.Day & "/" & Me.m_DateTimeFrom.Value.Year
    Dim m_tmpTo As String = Me.m_DateTimeTo.Value.Month & "/" & Me.m_DateTimeTo.Value.Day & "/" & Me.m_DateTimeTo.Value.Year
    
    strSubHeader = "'Inventory Report from " & m_tmpFrom & " to " & m_tmpTo & "'"
    
    Me.m_viewer.SelectionFormula = "{Inventory.Current_Date} in DateTime (" & Me.m_DateTimeFrom.Value.Year & ", " & Me.m_DateTimeFrom.Value.Month & ", " & Me.m_DateTimeFrom.Value.Day & ", 00, 00, 00)" & _
    "to DateTime (" & Me.m_DateTimeTo.Value.Year & ", " &  Me.m_DateTimeTo.Value.Month & ", " & Me.m_DateTimeTo.Value.Day & ", 00, 00, 00)"
    
    report.DataDefinition.FormulaFields.Item("reportType").Text = strSubHeader
    but this code doesnt works.....

  4. #4
    Join Date
    Dec 2004
    Location
    Connecticut
    Posts
    85
    I'm a VB newbie, so I'll start with the basics and see if we can figure it out.

    What is it, specifically, that doesn't work in your code?

    Does the report open without throwing an error?

    Do the parameters get passed to the report? You set the SelectionFormula and pass it to the viewer by manipulating the format of m_DateTimeTo and m_DateTimeFrom - why is their format different from Inventory.Current_Date? Can you set the formats to be the same or is it a given? Check the syntax. Something might be getting lost in the translation between VB and Crystal. Some versions of CR use their own syntax while others use "Basic Syntax" which may or may not interpret VB correctly. What happens if you set the parameters to date constants? Build it up one element at a time to see if and when it goes wrong.

    On the CR side, it normally expects an input to a parameter field that has been defined in the report. You should be able to set the individual values of {?StartDate} and {?EndDate} and pass them to the report. If you don't set the values using code, CR will prompt you for them.

    Can you display the parameter fields directly in the header of the report?

    Is it necessary to calculate strSubHeader using VB and pass it to the report? Or, can you let CR calculate strSubHeader for you? If you pass it to the report, what happens if you set strSubHeader to "This is my SubHeader string."?

    Check the syntax for strSubHeader. Again, something might be getting lost in the translation between VB and Crystal.

  5. #5
    Join Date
    Sep 2006
    Posts
    3
    well trowe thnx alot for ur time....
    i have figured it out....
    if u say ...i can post the code as well and tell how i did it.....
    it didnt took me much time ... but i got it .....
    thnx again.....

  6. #6
    Join Date
    Dec 2004
    Location
    Connecticut
    Posts
    85
    aamirch657,

    If you post the corrected code and describe how you figured it out, the next person searching for the answer to a similar problem will bless your little heart.

Posting Permissions

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