CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2001
    Posts
    4

    problem with SelectionFormula in Crystal Report Ctrl.

    Developed a report in Crystal report using 5 tables having primary key and foreign key relationship among them. using Crystal report control 4.6 in VB, it prints whole the records of all the dept in the Crystal Report's Query but have to print the employee records of the only one department.
    co-operate me.



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

    Re: problem with SelectionFormula in Crystal Report Ctrl.

    I have crystalReport 8.0 so maybe this do not apply to you. But have a try with this kind of sintax:
    Dim sql As String
    'reset control do discard old saved invormation
    Cr1.Reset
    'report pathName
    Cr1.ReportFileName = "D:\Condivisa\report\Report04.rpt"
    'type of report= use crystalreport type
    Cr1.ReportSource = 0
    'discard stored data
    Cr1.DiscardSavedData = True
    'change -if you wish - a where clause
    sql = "{persona.Cognome}='Imperiali'"
    Cr1.SelectionFormula = sql
    'make it print: two ways
    Cr1.Action = 1
    'or:
    'myvar = Cr1.PrintReport
    'MsgBox myvar

    another thing that may help you:
    '(Special thanks to SurrenderMonkey for this)
    'A simply report with one parameter field
    'called SelectMe in a omit formula for a section.
    'Matter is not to make the selection (I can workaround using
    'formulas). Matter is to pass a parameter value to a rpt file
    'through Ocx - or: to make parameter fields to be filled
    'via code form VB.
    Cr1.Reset
    Cr1.ReportFileName = "D:\Condivisa\Cesarevb\Crystol\cryweb\Report1.rpt"
    Cr1.ReportSource = 0
    Cr1.DiscardSavedData = True
    Cr1.ParameterFields(1) = "SelectMe;1;false" 'parameter field name={?SelectMe}
    'Cr1.ParameterFields(0) = "SelectMe;1;false"
    Cr1.Action = 1 'make it print

    Special thanks to Lothar "the Great" Haensler, Tom Archer, Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus.
    ...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.

  3. #3
    Join Date
    Apr 2001
    Posts
    4

    Re: problem with SelectionFormula in Crystal Report Ctrl.

    Again thanx for quick reply from nice guy like u.
    Thanx for u have send me coding, I was prefering coding only.
    Thanking u.



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