CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Crystal Report

  1. #1
    Join Date
    Jan 2000
    Posts
    13

    Crystal Report

    Hi,
    Can someone please tell me how to assign the reportselectionfomula during VB runtime.

    I need to assign 2 variable in the fomular, that is >= Variable1 and <= Variable 2.

    Thank you.


  2. #2
    Guest

    Re: Crystal Report

    Select by variable
    CrystalReport1.ReportFileName = App.Path & "\Custom\inventory for product.rpt"
    If cboModel.Text <> "" Then
    CrystalReport1.SelectionFormula = "{Inventory.ProdModel} = '" & cboModel.Text & "'"
    End If
    CrystalReport1.Action = 1
    CrystalReport1.SelectionFormula = ""

    Select by term
    Make a Table with two filds Date1 and Date2, then put those two fields on your report. Before you call that report in run time update the table with date.
    Date1 = txtFromDate.Text
    Date2 = txtToDate.Text
    CrystalReport1.ReportFileName = App.Path & "\Custom\Purchase Invoices by Term.rpt"
    CrystalReport1.SelectionFormula = "{PURCHASE INVOICE.PrchDate}" _
    & "In Date(" & Year(Date1) & ", " & Month(Date1) & ", " & Day(Date1) & ")" _
    & "To Date(" & Year(Date2) & ", " & Month(Date2) & ", " & Day(Date2) & ")"
    CrystalReport1.Action = 1
    CrystalReport1.SelectionFormula = ""



  3. #3
    Guest

    Re: Crystal Report

    just do

    crystral.selectionformula="{Query.whatever}>=" & variable1 & " And {Query.whatever}<=" & variable2



    If you're dealing with dates put in the single quotes as you would in an sql string



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