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
    60

    crystal/ parameters

    I am new to crystal.Im using version 4. I am trying to pass a parameter to the report and it doesn't seem to even see it. I am connecting to my dbase(access) via odbc.
    Here's part of my vb code:
    CrystalReport1.SQLQuery = "select * from contact where contact_type = '" & run_type & "' "
    Should I just be setting up the query in crystal? If so, what's the format because nothing I try seems to work.


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

    Re: crystal/ parameters

    I use another version of Crystal, so maybe not all of this may apply to you. However, you should be able to set from vb only the where clause of an Sql, not the whole:
    Code:
    Private Sub Command1_Click()
    
    Dim sql As String
    
    Cr1.Reset
    Cr1.ReportFileName = "D:\Condivisa\report\Report04.rpt"
    Cr1.ReportSource = 0
    Cr1.DiscardSavedData = True
    'the where clause
    
    'this, if you do not have a selection formula in your report
    sql = "{persona.Cognome}='Imperiali'"
    Cr1.SelectionFormula = sql
    
    'replace previous with:
    'sql = "{persona.Cognome}='Imperiali'"
    'Cr1.ReplaceSelectionFormula sql
    'if you have already one in rpt file
    
    Cr1.Action = 1
    'or:
    'myvar = Cr1.PrintReport
    'MsgBox myvar
    End Sub
    Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus.
    Last edited by Cimperiali; February 5th, 2004 at 06:35 AM.
    ...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
    60

    Re: crystal/ parameters

    I tried and it still does not work. I get a message "20599". thanks


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