Crystal Reports/SelectionFormula 
Author Message
 Crystal Reports/SelectionFormula

Help!  I have not been able to get Crystal Reports to recognize the
selection criteria that I'm passing from VB.  All my other properties seem
to be passed properly, but I'm not getting the correct records.  I had
originally set up the Record Selection Formula in CR, but I've tried
commenting it out before running my VB program and that doesn't help
either - I just get all the records in my DB.  I don't have any Group
Selection formulas set up at all.

It's as if CR doesn't get the SelectionFormula property from VB at all.

Here's my code - thanks in advance for any help you all can provide!

---
    CrystalReport1.SelectionFormula = "{Quote.Customer_Cd} = '" & _
           lblCustomerCd.Caption & "' AND {Quote.No} = " & _
          lblQuoteNo.Caption

    With CrystalReport1
        .ReportFileName = "QuoteShort.rpt"
        .DataFiles(0) = DbFullPath
        .Destination = crptToWindow
        .Action = 1
        'result = .PrintReport
        'If result <> 0 Then
         '   MsgBox .LastErrorNumber & ": " & .LastErrorString, _
         '   vbInformation, "Error"
        'End If
    End With

   Note:  I tried the code that I've commented out (PrintReport method)
first and then tried setting the Action property instead.  It didn't make
any difference.



Mon, 04 Sep 2000 03:00:00 GMT
 Crystal Reports/SelectionFormula

I figured it out!   I was using a caption in my formula (lblQuoteNo.Caption)
that contains a numeric value.  I needed to use the VAL function
(VAL(lblQuoteNo.Caption)) in order for my SQL to work properly against a
numeric DB field ({Quote.No} ).

Quote:
>Help!  I have not been able to get Crystal Reports to recognize the
>selection criteria that I'm passing from VB.  All my other properties seem
>to be passed properly, but I'm not getting the correct records.  I had
>originally set up the Record Selection Formula in CR, but I've tried
>commenting it out before running my VB program and that doesn't help
>either - I just get all the records in my DB.  I don't have any Group
>Selection formulas set up at all.

>It's as if CR doesn't get the SelectionFormula property from VB at all.

Here's my code - thanks in advance for any help you all can provide!

---
    CrystalReport1.SelectionFormula = "{Quote.Customer_Cd} = '" & _
           lblCustomerCd.Caption & "' AND {Quote.No} = " & _
          lblQuoteNo.Caption

    With CrystalReport1
        .ReportFileName = "QuoteShort.rpt"
        .DataFiles(0) = DbFullPath
        .Destination = crptToWindow
        .Action = 1
        'result = .PrintReport
        'If result <> 0 Then
         '   MsgBox .LastErrorNumber & ": " & .LastErrorString, _
         '   vbInformation, "Error"
        'End If
    End With



Wed, 06 Sep 2000 03:00:00 GMT
 Crystal Reports/SelectionFormula



Quote:
>Help!  I have not been able to get Crystal Reports to recognize the
>selection criteria that I'm passing from VB.  All my other properties seem
>to be passed properly, but I'm not getting the correct records.  I had
>originally set up the Record Selection Formula in CR, but I've tried
>commenting it out before running my VB program and that doesn't help
>either - I just get all the records in my DB.  I don't have any Group
>Selection formulas set up at all.

>It's as if CR doesn't get the SelectionFormula property from VB at all.

>Here's my code - thanks in advance for any help you all can provide!

>---
>    CrystalReport1.SelectionFormula = "{Quote.Customer_Cd} = '" & _
>           lblCustomerCd.Caption & "' AND {Quote.No} = " & _
>          lblQuoteNo.Caption

>    With CrystalReport1
>        .ReportFileName = "QuoteShort.rpt"
>        .DataFiles(0) = DbFullPath
>        .Destination = crptToWindow
>        .Action = 1
>        'result = .PrintReport
>        'If result <> 0 Then
>         '   MsgBox .LastErrorNumber & ": " & .LastErrorString, _
>         '   vbInformation, "Error"
>        'End If
>    End With

>   Note:  I tried the code that I've commented out (PrintReport method)
>first and then tried setting the Action property instead.  It didn't make
>any difference.

Liz
I gave up on SelectionFormula a while back because i didnt want to have
to format data selection differently. What I do now, following advice
from this ng, is SQL the data I want into another table, say ReportData
( you will need to drop the table first), and then when designing my
report use data from that table or an alias of it. if you want example

in subject line.

--
John McGuire  Resident of Stockport, UK



Wed, 06 Sep 2000 03:00:00 GMT
 
 [ 3 post ] 

 Relevant Pages 

1. Crystal Report : SelectionFormula question

2. VB and Crystal Report : Selectionformula with date

3. How to use Crystal Report SelectionFormula based on a variable cominf from a textbox

4. Crystal Report SelectionFormula

5. Setting Crystal Reports SelectionFormula thru VB4

6. SelectionFormula for Crystal Reports from VB

7. Crystal prob w/SelectionFormula

8. Crystal.SelectionFormula Problem

9. crystal rpt-SelectionFormula

10. Syntax for Crystal SelectionFormula Property

11. Announcement: Easily integrate Crystal Reports with Remedy with UFLTimeZone for Crystal Reports

12. Crystal Report 6 and Crystal Report 8


 
Powered by phpBB® Forum Software