Parameter Passing no data returned HELP!!

cltuser
10-27-2004, 05:54 AM
When I run my crystal report from vb6 using .dsr with code below I get no records returned.


Dim Report As CrystalReport1


Private Sub Form_Load()


Set Report = New CrystalReport1

PropTitle = FrmUtilities.TxtPropHeading.Text
ClsTitle = FrmUtilities.TxtClsHeading.Text
StClsTitle = FrmUtilities.TxtStClsHeading.Text
RoutTitle = FrmUtilities.TxtRoutHeading.Text
AcctTitle = FrmUtilities.TxtAcctHeading.Text
ResValTitle = FrmUtilities.TxtResValHeading.Text
ComValTitle = FrmUtilities.TxtComValHeading.Text
MapBlkTitle = FrmUtilities.TxtMapBlkHeading.Text
ClientTitleName = FrmUtilities.TxtClientName.Text
Eff_DOV_Date = FrmUtilities.TxtEffDate.Text
If ParmsArray(4) = "1" Then
InspectionWitness = "1"
Else
InspectionWitness = "0"
End If

If TypeOfReport = "R" Or TypeOfReport = "C" Then
If ReportKey = "1" Then
If FirstPart <> SecondPart Then
SelctFor = "({BASE.LCI} = {?TypeOfReport}) and ({BASE.ACCOUNT_NO} in {?FirstPart} to {?SecondPart})"
Else
SelctFor = "({BASE.LCI} = {?TypeOfReport}) and ({BASE.ACCOUNT_NO} like {?FirstPart})"
End If
ElseIf ReportKey = "2" Then
If FirstPart <> SecondPart Then
SelctFor = "({BASE.LCI} = {?TypeOfReport}) and ({BASE.MAP_BLK_LOT} >= {?FirstPart} AND {BASE.MAP_BLK_LOT} <= {?SecondPart})"
Else
SelctFor = "({BASE.LCI} = {?TypeOfReport}) and {BASE.MAP_BLK_LOT} LIKE {?FirstPart}"
End If
ElseIf ReportKey = "3" Then
If FirstPart <> SecondPart Then
SelctFor = "({BASE.LCI} = {?TypeOfReport}) and ({BASE.ROUTING_NO} >= {?FirstPart} AND {BASE.ROUTING_NO} <= {?SecondPart}) "
Else
SelctFor = "({BASE.LCI} = {?TypeOfReport}) and {BASE.ROUTING_NO} LIKE {?FirstPart}"
End If
ElseIf ReportKey = "4" Then
If FirstPart <> SecondPart Then
SelctFor = "({BASE.LCI} = {?TypeOfReport}) and ({BASE.SORT_PROPERTY_LOC} >= {?FirstPart}) AND ({BASE.SORT_PROPERTY_LOC} <= {?SecondPart})"
Else
SelctFor = "({BASE.LCI} = {?TypeOfReport}) and {BASE.SORT_PROPERTY_LOC} LIKE {?FirstPart}"
End If
End If
Else
If ReportKey = "1" Then
If FirstPart <> SecondPart Then
SelctFor = "({BASE.ACCOUNT_NO} in {?FirstPart} to {?SecondPart})"
Else
SelctFor = "({BASE.ACCOUNT_NO} like {?FirstPart})"
End If
ElseIf ReportKey = "2" Then
If FirstPart <> SecondPart Then
SelctFor = "({BASE.MAP_BLK_LOT} >= {?FirstPart} AND {BASE.MAP_BLK_LOT} <= {?SecondPart})"
Else
SelctFor = "{BASE.MAP_BLK_LOT} LIKE {?FirstPart}"
End If
ElseIf ReportKey = "3" Then
If FirstPart <> SecondPart Then
SelctFor = "({BASE.ROUTING_NO} >= {?FirstPart} AND {BASE.ROUTING_NO} <= {?SecondPart}) "
Else
SelctFor = "({BASE.ROUTING_NO} LIKE {?FirstPart}"
End If
ElseIf ReportKey = "4" Then
If FirstPart <> SecondPart Then
SelctFor = "({BASE.SORT_PROPERTY_LOC} >= {?FirstPart}) AND ({BASE.SORT_PROPERTY_LOC} <= {?SecondPart})"
Else
SelctFor = "({BASE.SORT_PROPERTY_LOC} LIKE {?FirstPart})"
End If
End If
End If




Report.RecordSelectionFormula = SelctFor
Report.ParameterFields(1).SetCurrentValue PropTitle
Report.ParameterFields(2).SetCurrentValue AcctTitle
Report.ParameterFields(3).SetCurrentValue ClsTitle
Report.ParameterFields(4).SetCurrentValue StClsTitle
Report.ParameterFields(5).SetCurrentValue RoutTitle
Report.ParameterFields(6).SetCurrentValue ResValTitle
Report.ParameterFields(7).SetCurrentValue ComValTitle
Report.ParameterFields(8).SetCurrentValue MapBlkTitle
Report.ParameterFields(9).SetCurrentValue SecondPart
Report.ParameterFields(10).SetCurrentValue FirstPart
Report.ParameterFields(11).SetCurrentValue ReportKey
Report.ParameterFields(12).SetCurrentValue TypeOfReport
Report.ParameterFields(13).SetCurrentValue ClientTitleName
Report.ParameterFields(14).SetCurrentValue Eff_DOV_Date
Report.ParameterFields(15).SetCurrentValue InspectionWitness

'Report.DiscardSavedData


CRViewer1.ReportSource = Report
CRViewer1.ViewReport
Me.Show
Screen.MousePointer = vbDefault

End Sub If I uncomment the command to DiscardSavedData and execute...the prompting window comes up for me to supply the parameters then I get the desired results. I don't understand what I'ved done wrong. I know that the discard saved data will erase any parameter fields values I have given the report but what about when I supply those parameters...I get no returned records??? All of my variables used to supply parameter fields for the report were defined as string and set as global variables when the application first starts. Despartely seeking a solution! This has frustated me for two days now. Please help! Thanks in advance.

MKoslof
10-29-2004, 01:07 PM
Look here for parameter passing in Crystal Reports. Let me know if you have any more questions:

http://www.xtremevbtalk.com/showthread.php?t=177362

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum