473,386 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Filter Data In vb6 + Crystal Report 10

284 100+
I am using vb6 and crystal report 10 (sql server 200 as database) to display record.

I am using .rpt format for crystal report to display data. I am using net examples I am successfully able to display the data but unable to filter it.

I want to know what is the syntax,formula for filtering the report using vb6.

Here is the code I am using to display report.

Expand|Select|Wrap|Line Numbers
  1. Public CRReport As New CRAXDRT.Report
  2. Public CRApp As New CRAXDRT.Application
Expand|Select|Wrap|Line Numbers
  1. Public Sub CrysRpt(CrytalOCX As Object, RptPath As String, DBPath As String, DBPassword As String)
  2.  
  3.   '-Assign Path to Report
  4.   Set CRReport = CRApp.OpenReport(App.Path & RptPath)
  5.  
  6.   On Error GoTo ExitLabel
  7.  
  8.   With CRReport '-// Log-On to Database with Password Protect
  9.  
  10.   '-//====================================
  11.   .Database.Tables(1).SetLogOnInfo App.Path & DBPath, App.Path & DBPath, "", DBPassword
  12.  
  13.   End With
  14.  
  15.     With CrytalOCX
  16.  
  17.         'Set the source of Report viewer to the path of Report you made
  18.         .ReportSource = CRReport
  19.  
  20.         'View/Display Report
  21.         .ViewReport
  22.  
  23.     End With
  24.  
  25.     CRApp.CanClose
  26.  
  27. Exit Sub
  28.  
  29. ExitLabel:     MsgBox Err.Number & " " & Err.Description, vbCritical
  30.  
  31. End Sub
  32.  
Calling Function to display report

Expand|Select|Wrap|Line Numbers
  1. On Error GoTo loaderr
  2. Screen.MousePointer = vbHourglass
  3. Call CrysRpt(CRViewer1, "\BanksInformation.rpt", "\My Bank.mdb", "asd987123")
  4. CRReport.ParameterFields(1).AddCurrentValue (250)
  5. Screen.MousePointer = vbNormal
  6. Exit Sub
  7. loaderr:
  8. MsgBox Err.Description
  9. Exit Sub
  10. End Sub
Mar 3 '12 #1
1 4196
your query is equal to
select * from table1

meaning you get all the data contained by table1..

how did you connect your system in your database?..

RDO, ADO or ADODC?

if you can do some sql statement.. then maybe try this..

'for example you have comboBoxFields

dim strSql As String
dim strFieldToFilter As String
strFieldToFilter = "comboBoxFields.text"

strSql = "SELECT " & strFieldToFilter & " FROM your_table_name"

'for example you used ADODC as your connection

adodc1.refresh
adodc1.doSql strSql
Mar 17 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Danny J. Lesandrini | last post by:
First, this is _not_ a question about how to get Crystal Reports to run on a client machine. I've got all the merge modules added to the project and it's working fine. The question is about...
0
by: Ori | last post by:
Hi, I create a report (using Crystal report V 9) which using more than one table to retrieve and filter data. This report receiving a single parameter ("CustomerID") and suppose to show...
2
by: Henry | last post by:
I am trying to write an application that allows me to dynamically load selected Crystal Report files, read the parameters from the report file, give the user a chance to enter relevant data in a...
3
by: Matt MacDonald | last post by:
I'm trying to run a report using a form containing a crystal report viewer, but I keep getting an error saying tha "The specified value type is different to the current value type I'm trying to use...
0
by: Danny J. Lesandrini | last post by:
Didn't get any takers on this post this morning at dotnet.General, so I'm reposting here. First, this is _not_ a question about how to get Crystal Reports to run on a client machine. I've got...
6
by: Ray | last post by:
Hi all, While I use the ReportDocument of vb.net to set filter to the data to the Crystal Report, it is successful for the first time while running the program. However, for the second time while...
0
by: Ray | last post by:
Dear Bernie, Yes, if the same pfieldname is used. The same data will be filtered. But I only use the code shown you before. I have not used any dataset or datatable. How to fix the problem?...
0
by: dzemo | last post by:
Which is the fastest way to "pump" data into crystal report in vb.net 2003? Is it: 1. content report as set datasource to dataset and filter data on fill dataset 2. set an output file and set...
0
by: Kinjal Ladani | last post by:
Hello, I have one application in vb.net with oracle 10g database. i have one crystal report with subreport in my application,. now my problem is i want to filter some data in crystal report and in...
1
by: charvi | last post by:
hi i want to create a crystal report8 with vb6 i designed a project time sheet in vb6.now i want a report on each staff i.e i designed a form with one text box where staff name is written as by...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.