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.

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

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

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.

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

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

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.

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

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")

Hi,

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

Regards
Veena

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.

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.

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.

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

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

Try replacing rsCommand1 with Command1

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

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

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.