CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    May 2003
    Location
    austria
    Posts
    5

    changing text field value on runtime

    hi group,

    i have a problem that didn't show up on any sample files or in two books i bought (crystal reports for dummies and wrox - professional crystal reports for vs.net).

    my users can specify the date range of the report on a web-form by filling start and end date into two textboxes before the dataset behind the report is filled.

    in no example to reports ever show the exact date range selected in the report header. it's always like '... 2001' but what if users specified 10/23/02 to 11/15/02? how do i show the selected dates in the report header?

    thanks if anyone can help me with it.

    chris

  2. #2
    Join Date
    Dec 2001
    Posts
    6,332
    You can use the Format() function to specify the format.
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

  3. #3
    Join Date
    May 2003
    Location
    austria
    Posts
    5
    hi wizbang,

    probably i didn't point it out clear enough, i'd be happy if it was a problem with formating or i don't get your hint.

    i have a web-form with two text-boxes for date entries (beginn and end date), two drop down lists (one for choosing the report) and two buttons (one for producing the crystal report as pdf and sending it to the browser, the other for sending the report to the report viewer on the web form). all of this works fine.

    the problem is that in the produced report i need the beginn and end dates specified in the two text boxes before producing the report. the two dates from the boxes are used for specifying data fed into a dataset by altering the underlying sql statement. the dataset content that is pushed into the report. because users who see the report need to excactly know what period the report covers, the begin and end date from the sql-statement should be quoted in the report header.

    to be honest for the beginnen i don't care in which format the dates show up as long as they do.


    any ideas?

  4. #4
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Thus, passing parameters?

    It seems as if yours is a matter of passing parameters to Crystal Report.
    If this is the case, then look at what Babu, iamgautham and dinesh123 wrote:
    from:
    http://www.codeguru.com/forum/showth...ameter+crystal
    There is a formula editor in the Crystal report where u can build the formula.
    U can pass the formula from the code to Crystal report SelectionFormula parameter.
    Eg:
    CrystalReport1.SelectionFormula =" {dept.EMPLOYEE ID} = {employee.EMPLOYEE ID}"
    U can get more help from the Cystal report help.
    from:
    http://www.codeguru.com/forum/showth...ameter+crystal
    using automation server(cpeaut32.dll)
    after creating application, report objects etc..

    Private mobjcrpParam As CRPEAuto.ParameterFieldDefinition
    Private mobjcrpParams As CRPEAuto.ParameterFieldDefinitions

    Set mobjcrpParams = mobjcrpRep.ParameterFields
    '' where mobjcrpRep is the report object
    mobjcrpRep.ParameterPromptingEnabled = False
    '' to prompt the parameter window or not
    Set mobjcrpParam = mobjcrpParams.Item(1)

    Dim paramValue As String
    paramValue ="HELLO"
    mobjcrpParam.SetCurrentValue paramValue
    from:
    http://www.codeguru.com/forum/showth...0&pagenumber=1
    Re: Crystal Report
    hi,
    That formulas(0) value is incorrect.
    First, you have to create formula in crystal report design time.
    assume "myVar" is your formula variable
    Then you pass the value to that variable like
    CrptHistory.Formulas(0) = "myVar = 'Hello'"

    yours,
    Babu

    '------------------------------------------------

    Re: Many Problems in Crystal Reports
    hi,
    for example you want to print name = 'Raj'
    ' you should enter the single quote for string data type
    cr.SelectionFormula = "{Employee.Name} = 'Raj'"
    'you no need to enter single quote for numeric data type.
    cr.SelectionFormula = "{Employee.RecNo} = 10001"

    do your level best.
    Babu
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  5. #5
    Join Date
    Jun 2002
    Location
    New Delhi
    Posts
    20
    Code:
    Dim scSection As CRAXDRT.Section
    Dim strTitle as String
    
    'strTitle is the title to be appeared in the report
    strTitle = "Report between 01-05-2003 and 02-05-2003"
    ' Section5 is the Section number of the Report Header
    Set scSection = crReportDesigner.Sections("Section5")
    addTitle scSection, strTitle
    
    'Procedure for adding titles in the crystal reports
    Public Sub addTitle(scSection As CRAXDDT.Section, strTitle As String)
    Dim crTitleText As TextObject
         
        Set crTitleText = scSection.AddTextObject(strTitle, 200, 120)
         
        With crTitleText
            .Font.Name = "Arial Arabic"
            .Font.Size = 10
            .Font.Bold = True
            .TextColor = &HFF&
            .Height = 400
            .HorAlignment = crHorCenterAlign
            .Width = 10000
            .CanGrow = True
        End With
    End Sub
    
    
    'strTitle is the title to be appeared in the report 
    ' Section5 is the Section number of the Report Header 
    'Procedure for adding titles in the crystal reports
    
    Last edited by Cimperiali; June 2nd, 2003 at 07:26 AM.
    Gnanavel

    Fortune favours the brave

  6. #6
    Join Date
    May 2003
    Location
    austria
    Posts
    5
    hi Ramagnanavel,

    from the way it looks i have the feeling you understood what my problem is. so i tried to do the same in my program, but there remain unsolved issues.

    the namespaces i have are the following:
    Imports CrystalDecisions.CrystalReports.Engine
    Imports CrystalDecisions.Shared
    Imports System.Data.OleDb
    Imports System.Data

    after i copied your code samples, i do get error messages from the following parts:

    Dim scSection As CRAXDRT.Section

    what is craxdrt? i didn't find entires abou it in the help files

    i found some things about it on the web. didn't it install with my vs.net enterprise architect standard installation? i had my harddisk searched for craxdrt9.dll and didn't get any results.

    so next i try to find our what craxdrt9.dll is. things are just never that easy are they? who thought that transferring a string into a cr would be that complicated? i didnt.

    thanks for your help

    chris

  7. #7
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    DotNet?

    the namespaces i have are the following:
    Imports CrystalDecisions.CrystalReports.Engine
    Imports CrystalDecisions.Shared
    Imports System.Data.OleDb
    Imports System.Data
    You're not using Crystal Report with Vb6.0. You're using it with DotNet...
    If this is the case, I think I should move your post to an appropriate forum (Vb.Net forum)...
    Cesare Imperiali
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  8. #8
    Join Date
    May 2003
    Location
    austria
    Posts
    5

    crystal reports changing text field value on runtime

    hi group,

    i moved the thread from another vb forum where i posted it by accident.


    '-----
    [Cimperiali note: the thread is now listed above]
    '----


    i'm looking for a way to transfer a string into the report header of a crystal report. i'm working with vb.net enterprise architect standard installation (with other lanugages not installed).

    just learned that there is something called craxdrt9.dll to be installed. is this only for vb6 or also for .net? i couldn't find it on my harddrive.

    any help appreciated a lot, bought two books but it was never mentioned.

    chris
    Last edited by Cimperiali; June 2nd, 2003 at 01:31 PM.

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

Featured