CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2005
    Posts
    62

    Unhappy how to give selection formula

    hi,
    i have designed one report. i want to display records ,for that i will specify the range like prodno between 1 to 100 then it will print the record from 1 to 100. if i specify 10 to 20 then it will print 10 to 20.
    in selection formula i have written following code

    with cr1
    .Connect = strr1
    form1 = "{product_tab.prod_id}>" & txtfrom & " and {product_tab.prod_id}<=" & txtto

    .SQLQuery = "select * from product_tab"
    .SelectionFormula = form1
    .WindowShowPrintBtn = True
    .WindowState = crptMaximized
    .Action = 1
    end with
    in txtfrom i m specifying lower limit & txtto upper limit.
    but it is not displaying records. can anyone tell me what i ve to write in seletion formula.

  2. #2
    Join Date
    Jun 2006
    Posts
    60

    Re: how to give selection formula

    Are you using the Crystal OCX control to display the report?
    It is bad practice to override .SQLQuery, because it is already contained in the RPT file. Just set the .SelectionFormula to limit the rows returned by the query in the report.
    SQLQuery should only be altered if there is no other way to achieve what you want, for example, if you want to replace some tables in your report. I haven't used OCX for ages, but IIRC if you change the SQLQuery, the SelectionFormula no longer works, as it is overridden by the SQLQuery.

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