Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Database and Reporting > Parameter Passing no data returned HELP!!


Reply
 
Thread Tools Display Modes
  #1  
Old 10-27-2004, 04:54 AM
cltuser cltuser is offline
Freshman
 
Join Date: Sep 2004
Posts: 46
Default Parameter Passing no data returned HELP!!


When I run my crystal report from vb6 using .dsr with code below I get no records returned.

Code:
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.
Reply With Quote
  #2  
Old 10-29-2004, 12:07 PM
MKoslof's Avatar
MKoslof MKoslof is offline
Cum Grano Salis

Retired Moderator
* Guru *
 
Join Date: Jul 2002
Location: Baltimore, Maryland
Posts: 14,636
Default

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
__________________
"Artificial Intelligence is no match for natural stupidity." ~unknown
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->