954,559 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

showing specific records using vb6 datareport

Hi
I have a problem,
i have designed a database program with vb6 and ms access. and the program is suppose to display specific records using datareport. eg ,display records of student whose fees are> 10000. But i dont know my way out. hope to get help from anybody.thanks in advance.

TOROOOLOLOOLO
Newbie Poster
16 posts since Oct 2007
Reputation Points: 10
Solved Threads: 0
 

Hi,

I have done it the past by having a query in Access that returns the wanted records. Then call that query from VB and display/access the records.

Hope this helps

Denis

DenisOxon
Posting Whiz
355 posts since Jan 2007
Reputation Points: 22
Solved Threads: 19
 

use ms access query and than use it any where... simple..

4ukh
Junior Poster in Training
70 posts since May 2008
Reputation Points: 13
Solved Threads: 1
 

Hi
I am still not clear.the fact is that my program has two command buttons, one button is supose to display records with FEES < 2000
and the other button is also supose to display FEES>2000.
I realy need help.

TOROOOLOLOOLO
Newbie Poster
16 posts since Oct 2007
Reputation Points: 10
Solved Threads: 0
 

in ms access design your query in design view add your table into the query window and than double click on the fields which you may need for the query like fees of the student and in the criteria row just write the condition < 2000 under the fees column and than save and run the query hope this will help if not just let us know...

thank you

4ukh
Junior Poster in Training
70 posts since May 2008
Reputation Points: 13
Solved Threads: 1
 

Right-Click Command Object (Say Command1)
Edit your Command's SQL Query and
make it :

Select * From MyTable Where Fees Between ? And ?

Click on apply

Parameter Tab Is Enabled, Go there..
Set these properties for both Parameters:
DataType = adDoble
HostDataType =Currency
And Apply,
Save the Project

In The Calling Form, For <2000 buttonClick, write this code:

Load DataEnvironment1
      With DataEnvironment1
        If .rsCommand1.State <> 0 Then .rsCommand1.Close
          .Command1 0, 2000
        End With
      DataReport1.Show


In The Calling Form, For between 2000 to 10000 buttonClick, write this code:

Load DataEnvironment1
      With DataEnvironment1
        If .rsCommand1.State <> 0 Then .rsCommand1.Close
          .Command1 2001, 10000
        End With
      DataReport1.Show


I HOPE IT IS CLEAR..

Regards
Veena

QVeen72
Posting Shark
950 posts since Nov 2006
Reputation Points: 84
Solved Threads: 143
 

Thanks QVeen72. I apreciate your help. but i dont know what you mean by "Right-Click Command Object (Say Command1) and Parameter Tab ". i dont know where to locate and right click Command Object . pls be precise, i am naive. hope to hear from you.

TOROOOLOLOOLO
Newbie Poster
16 posts since Oct 2007
Reputation Points: 10
Solved Threads: 0
 

Hi,

I Guess, you have created the DataReport, based on a COMMAND Object in DataEnvironment, You have to do the above process for that Command Object

Regards
Veena

QVeen72
Posting Shark
950 posts since Nov 2006
Reputation Points: 84
Solved Threads: 143
 

Thanks QVeen72. I apreciate your help.but after doing what u asked me to do, it gives me a compile error ("Member or data Member not found")

TOROOOLOLOOLO
Newbie Poster
16 posts since Oct 2007
Reputation Points: 10
Solved Threads: 0
 

Hi,

What Line you are getting the error..? Post your Code Here..

Regards
Veena

QVeen72
Posting Shark
950 posts since Nov 2006
Reputation Points: 84
Solved Threads: 143
 

Hi QVeen72
The line i am getting the error from is;
If .rsCommand1.State <> 0 Then .rsCommand1.Close.
With the phrase (rsCommand1) highlighted in blue.

TOROOOLOLOOLO
Newbie Poster
16 posts since Oct 2007
Reputation Points: 10
Solved Threads: 0
 

Hi QVeen72
The line i am getting the error from is;
If .rsCommand1.State <> 0 Then .rsCommand1.Close.
With the phrase (rsCommand1) highlighted in blue.

TOROOOLOLOOLO
Newbie Poster
16 posts since Oct 2007
Reputation Points: 10
Solved Threads: 0
 

with reference to QVeen72 earlier post, if u have copied and pasted the code for the SQL Query then maybe the table name u have got wrong.

Select * From MyTable Where Fees Between ? And ?


Here replace the MyTable with relevant table name of ur database.

aktharshaik
Posting Whiz
316 posts since Aug 2008
Reputation Points: 26
Solved Threads: 40
 

Hi aktharshaik
I just did what u said but it gives me a Compile error (Argument not optional)

TOROOOLOLOOLO
Newbie Poster
16 posts since Oct 2007
Reputation Points: 10
Solved Threads: 0
 

what is the Name property of your Command Object. is it rsCommand1 or only Command1

Try replacing rsCommand1 with Command1

aktharshaik
Posting Whiz
316 posts since Aug 2008
Reputation Points: 26
Solved Threads: 40
 

Hi toroo...,

What is the SQL Query of the Command Object (On which report is Based)
Say if your Command Object's name is "Command5", then
You need to pre-fix with "rs"
and it becomes rsCommand5

Regards
Veena

QVeen72
Posting Shark
950 posts since Nov 2006
Reputation Points: 84
Solved Threads: 143
 

All The Option Under Parameter Tab are Disabled How To Enabled Please Help

anandlalroy
Newbie Poster
1 post since Sep 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You