hi!
im newbi here..
i want to know how to pass parametersfrom a from on vb to a report.. if the user enters a string to search for i want to show a report correponding only to that sting.. how i do it__
im using vb 6.0 and crystal reports 8.0
thx
Printable View
hi!
im newbi here..
i want to know how to pass parametersfrom a from on vb to a report.. if the user enters a string to search for i want to show a report correponding only to that sting.. how i do it__
im using vb 6.0 and crystal reports 8.0
thx
In Crystal, add a Parameter to your report (Insert -> Field Object -> Parameter Fields)
Then modify the Record Selection formula so that the database field must be equal to the parameter field. For example,
{Authors.LastName} = {?AuthorName}
Crystal will then use this information to create a SQL statement to the database, ie
Select * From Authors Where LastName = 'King'
Then in VB, there are two methods to prompt the user. Let Crystal handle everything or do it yourself. By default, Crystal will automatically prompt the user for the paramter values.
How do you currently show the report in VB? Let me know if you want information on handling the parameters your self.
thanx..
i want to set that formula from my vb aplication, i added a crystal report control and someone told me that i can use the formulas property to send the formula to the reporte already done, then crystal will use that record formula..
but id ont know how to set the formulas property... vb just sends me syntaxis errors..
i have these lines and i set some other parameters of the report in other form, like the reportName
me.CrystalReport1.Formulas="{asistencias.id_alumno}='"&me.DBLAlumnos.BoundText&"' "
Me.CrystalReport1.WindowTitle = Me.txtWindowTitle Me.CrystalReport1.DataFiles(0) = Me.txtReportDBName Me.CrystalReport1.ReportFileName = Me.txtReportName Me.CrystalReport1.CopiesToPrinter = Me.txtCopias
i have a DBList control which shows the students name, so if i select an item it should send the ID (alumno_id) to the formula, to get just the report of that student..
thx for all..
You need to set the selection formula
VB Code:
me.CrystalReport1.SelectionFormula = "{asistencias.id_alumno}='"& me.DBLAlumnos.BoundText & "'"
thanx..
i just tried the code, and it stopped sending syntaxis errors, but now when i run the application it sends an error:
20515: Error in file asistencias.rpt
Error in Formula <recod_selection>
The remaining text does not appear part of the formula
...................
if i run this formula in the crystal report it does work but not from my application, what can be happening??
i found the reason...
i should use another property, this is the code...
Me.CrystalReport1.ReplaceSelectionFormula ("{asistencias.id_alumno}='" & Me.DBLAlumnos.BoundText & "'")
thanx to all..