Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

easy help..but not so easy for me!

Status
Not open for further replies.

jhermiz2

Programmer
Dec 2, 2003
62
US
In my vb application I have created a crystal viewer...
I allow the end user to select a customer from my own combo box in the application..and I do the following vb code

Code:
'Proposals report
    Case "rptProposalInfo"
        If frmReports.cboRptQuoteNumbers.Text = "" Then
        'no quote
        Else
            objReport.RecordSelectionFormula = "{vwProposalInformation.ProposalID} = " & frmReports.cboRptQuoteNumbers.ItemData(frmReports.cboRptQuoteNumbers.ListIndex)
            GoTo LabelViewReport
        End If
    
        If frmReports.cboRptCustomers.Text = "" Then
            'no customer AND no quote...that means
            'NO criteria has been selected..so we simply view
            'the report
            GoTo LabelViewReport
        Else
            strFormula = "{vwProposalInformation.CustomerName} = '" & frmReports.cboRptCustomers.Text & "'"
        End If
    
        If frmReports.cboRptSites.Text = "" Then
            'no customer AND no quote...that means
            'NO criteria has been selected..so we simply view
            'the report
            objReport.RecordSelectionFormula = strFormula
            GoTo LabelViewReport
        Else
            strFormula = strFormula & " And {vwProposalInformation.SiteName} = '" & frmReports.cboRptSites.Text & "'"
        End If
        
        If frmReports.cboRptComms.Text = "" Then
            'no customer AND no quote...that means
            'NO criteria has been selected..so we simply view
            'the report
            objReport.RecordSelectionFormula = strFormula
            GoTo LabelViewReport
        Else
            strFormula = strFormula & " And {vwProposalInformation.Commission} = '" & frmReports.cboRptComms.Text & "'"
            objReport.RecordSelectionFormula = strFormula
        End If

That is I use the RecordSelectionFormula right inside of VB...but at the same time I want to use the record selection in Crystal...

But if I put this in crystal's Select Expert:
(if {?Status} = ""
then True
else {vwProposalInformation.Status} = {?Status})

It will prompt me ... but it will ignore the customer I selected in my vb application...Meaning I think the record selection gets confused...anyway to tell crystal to use my record selection and ADD to it the record selection from Crystal? It seems like it is overwriting it currently.

Thanks gurus,
Jon
 
Sounds like you need to get the text of the record selection formula from the report, then append to it. Something like:
[tt]
Dim strCurrentRecSelection

strCurrentRecSelection = objReport.RecordSelectionFormula
strFormula = "({Table.Field} = 'Value')"

objReport.RecordSelectionFormula = strCurrentRecSelection & " And " & strFormula
[/tt]
-dave

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top