Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Create counter in VB6 DataReport

Posted on 2003-03-11
Medium Priority
Last Modified: 2008-03-17
I prefer to use VB6 built-in DataReport to create reports from my database, however I couldn't find any help on how to create counters for my reports.

As an example I wanted to produce reports like:

item id product
---- -- -------
1    01 keyboard
2    02 mouse
3    04 monitor

I can fill the id and product field with data from database, but how do I generate the item counter?

Question by:myShanai
  • 2
  • 2

Expert Comment

ID: 8115965

I Real do not understand quite well of what you want, cause my english is not very good, but i think that you want a a counter for each report of each item, if this is the case, why don't you put in your database the counters for each item?
For instance if you have 3 Items, as above, Keyboard, Mouse and Monitor, you can create fiels Counter1 for Keyboard, Counter2 for Mouse and Counter3 for Monitor.
Each time you open a report just update your field counter.
Other way that i have made for a statistics reports, is to create a new table CounterReports, with fields of each reportname, and update the fields. Ex:

data1.recordsource = "CounterReports"     'Mytable counters
data1.recordset.absoluteposition=0       'My Unique Record
data1.recordset.fields(1)= = data1.recordset.fields(1)+1  'Keyboard
data1.recordsource = "Table1"       'Return to my original table

Now in your report you can make a field indexed to counterreports field(1), and have tour value counter ofr each report.

Hope it helps you


Author Comment

ID: 8117032
What I meant was not a counter to count how many keyboard,mouse or monitor. But instead, like a numbered list, or may I re-phrase it as record numbers.
For an example, if I search for products from the "computer" category, the reports will display a list of items such as:

item id product stock
---- -- ------- -----
1    01 keyboard 20
2    02 mouse    35
3    04 monitor  19
4    08 cd drive 24

This actually can easily be done if we use Crystal Reports, which is by inserting "record number field".
But VB6 Data Report doesn't have that feature.

Expert Comment

ID: 8145297
Sorry I can't Figure the Way.

Expert Comment

ID: 9474557
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Post your closing recommendations!  No comment means you don't care.

Accepted Solution

myShanai earned 0 total points
ID: 9491287
I think there is no way VB6 could do that within it's built-in data report.

The solution is to use Crystal Report instead. Thanks for those who tried to help me.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question