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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parameters are missing (Crystal 10 & VB6)

Status
Not open for further replies.

crisedefoie

Programmer
Feb 19, 2003
39
0
0
CA
HI

I have an vb6 application using crystal 10 reports.
When I want to send parameters to my reports, it doesn't work. I see the parameter prompt windows.
However, my debugger tells me that the value was good.

These is a part of my code :

Select Case pParamDef.ValueType
Case 9 'boolean
pParamDef.SetCurrentValue CBool(psValue)
Case 10 'Date
pParamDef.SetCurrentValue CDate(psValue)
Case 1, 2, 3, 4, 5, 6
pParamDef.SetCurrentValue CInt(psValue)
Case 7 'Numeric
pParamDef.SetCurrentValue Val(psValue)
Case Else 'String
pParamDef.SetCurrentValue psValue
End Select

In the 'Immediate' windows of VB I see :
? pParamDef.GetNthCurrentValue(1)
TheRightValue
? pParamDef.IsCurrentValueSet
True

But these parameters didn't go to my reports.

Does someone know why it always doesn't work and how to solve it?

Thank you
 
Thanks a lot synapsevampire

But the code in these exemples is the same of mine but it doesn't work :-(

That appears so simple, however



 
What's your code immediately following the setting of your parameters, up until you send the report to a CRViewer/Printer?

-dave

 
Vidru, this my code after the parameters setting :

For Each table In CrxReport.Database.tables
Set props = table.ConnectionProperties
Dim laTypeDb As TypeDb
If UCase(props.item("Provider")) = "SQLOLEDB" Or UCase(props.item("Provider")) = "SQLOLEDB.1" Then
If UCase(props.item("Initial Catalog")) = "SIGEOF" Then
laTypeDb = tdbSigeof
Else
laTypeDb = tdbInfoSysteme
End If
Else
laTypeDb = tdbRapport
End If

For Each prop In props
Select Case UCase(prop.Name)
Case "PASSWORD"
Select Case laTypeDb
Case TypeDb.tdbSigeof
prop.Value = strUsager.MotPasseSigeof
Case TypeDb.tdbRapport
'prop.Value = strUsager.Mot
Case TypeDb.tdbInfoSysteme
prop.Value = gFichier.MotPasse
End Select
Case "USER ID"
Select Case laTypeDb
Case TypeDb.tdbSigeof
prop.Value = strUsager.usager_base_sigoef
Case TypeDb.tdbRapport
'prop.Value = strUsager
Case TypeDb.tdbInfoSysteme
prop.Value = gFichier.Usager
End Select
Case "PROVIDER"
Select Case laTypeDb
Case TypeDb.tdbSigeof
prop.Value = IIf(InStr(UCase(strUsager.chemin_accès_base_sigoef), ".MDB") = 0 _
, "SQLOLEDB.1", "Microsoft.Jet.OLEDB.4.0")
Case TypeDb.tdbRapport
prop.Value = IIf(InStr(UCase(lsCheminDbRapport), ".MDB") = 0 _
, "SQLOLEDB.1", "Microsoft.Jet.OLEDB.4.0")
Case TypeDb.tdbInfoSysteme
prop.Value = IIf(InStr(UCase(gFichier.RepSYS), ".MDB") = 0 _
, "SQLOLEDB.1", "Microsoft.Jet.OLEDB.4.0")
End Select
Case "DATA SOURCE"
Select Case laTypeDb
Case TypeDb.tdbSigeof
prop.Value = strUsager.ServeurSigeof
Case TypeDb.tdbRapport
prop.Value = lsCheminDbRapport
Case TypeDb.tdbInfoSysteme
prop.Value = gFichier.NomServeur
End Select
Case "INITIAL CATALOG"
Select Case laTypeDb
Case TypeDb.tdbSigeof
prop.Value = strUsager.chemin_accès_base_sigoef
Case TypeDb.tdbRapport
prop.Value = lsCheminDbRapport
Case TypeDb.tdbInfoSysteme
prop.Value = gFichier.RepSYS
End Select
End Select
Next
table.Location = table.Name
table.TestConnectivity
Next
CrxReport.ReportTitle = titre
CrxReport.RecordSelectionFormula = chaîne_sélection
'CrxReport.EnableParameterPrompting = False
CrxReport.VerifyOnEveryPrint = True
Load frmReportViewer
frmReportViewer.AfficherRapport CrxReport
Unload frmReportViewer
 
Thanks a lot Vidru!

Your trick works! It,s a shame I didn't try it by myself.

I tought the solution was so complicated.

Now I'll keep this in my mind : Keep it simple!

Bye

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top