hi friends

Iam developing my appliction in vs.net2003 & ms access.I am creating reports using crystal report.I want to filter the output of report.User has to select the option which data has to be display in reports.I used the parmeter wizard to sort data.But if I add new data in database it display blank report.What goes wrong I don't know.Plz help me

Dani AI

Generated

Summary and focused troubleshooting (for the original question from and the SelectionFormula suggestions by / and the formula-fields link from ).

Common reasons a report shows blank after adding new rows:

  • The report file was saved with data so the viewer shows the saved snapshot instead of fetching new rows. See the Crystal Reports note on "Save Data With Report." (https://userapps.support.sap.com/sap/support/knowledge/en/2745501).
  • The runtime report source or login wasn’t refreshed/applied, or parameters/selection were applied only at viewer level without forcing a fresh database fetch.

Practical checklist (apply in this order)

  1. Confirm the .rpt is not using saved data; uncheck "Save Data With Report" in the designer or call the API to discard saved data. See ReportDocument.Refresh for using code to remove saved data. (https://learn.microsoft.com/en-us/previous-versions/ms225968%28v%3Dvs.90%29).
  2. If a programmatic filter is needed, either use the viewer selection property (what was suggested earlier) or set the report-level record selection so the engine applies the filter when querying the database; see CrystalReportViewer.SelectionFormula and ReportDocument.RecordSelectionFormula. (https://learn.microsoft.com/en-us/previous-versions/ms227019%28v%3Dvs.90%29) (https://learn.microsoft.com/en-us/previous-versions/ms225976%28v%3Dvs.90%29).
  3. For parameterized reports, push parameter values into the ReportDocument (preferred) rather than only into the viewer; use ReportDocument.SetParameterValue when binding values in VB.NET. After setting logon/parameters, force a refresh so the viewer pulls current rows. (https://learn.microsoft.com/en-us/previous-versions/cc411357%28v%3Dvs.90%29) (https://learn.microsoft.com/en-us/previous-versions/ms225968%28v%3Dvs.90%29).

Minimal VB.NET pattern (adapt to the report and connection method)

Dim rpt As New ReportDocument()
rpt.Load("MyReport.rpt")
rpt.SetDatabaseLogon("dbUser","dbPass")   'or apply logon per-table if needed
rpt.SetParameterValue("StudentID", 123)
rpt.Refresh()
CrystalReportViewer.ReportSource = rpt

Extra checks: if subreports are used, verify links and that the main report returns rows — a linked subreport will be empty if the values passed or link fields are wrong. (https://userapps.support.sap.com/sap/support/knowledge/en/1200639). Also match parameter/data types (string vs numeric) and use fully qualified field names in selection formulas when required.

Recommended Answers

All 3 Replies

to filter u can use CrystalReportViewer.SelectionFormula;
For examaple To filter by a Customer_Id = 1
u can use
CrystalReportViewer.SelectionFormula ="Where Customer_Id = 1"

if u r using multiple selection formula u hav to use "and" or "or" to combine it

i think Arshad already give the solution

CrystalReportViewer.SelectionFormula() = "{Student.id_student}='" & Trim(txtIdStudent.text) & "' "

Student is the table Name & id_student is parameter

commented: thx :) +1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.