Link to home
Start Free TrialLog in
Avatar of myShanai
myShanai

asked on

Create counter in VB6 DataReport

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?

thanks
Avatar of JoaTex
JoaTex

Hi

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.edit
data1.recordset.fields(1)= = data1.recordset.fields(1)+1  'Keyboard
data1.updaterecord
data1.recordsource = "Table1"       'Return to my original table
data1.refresh

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
jo

Avatar of myShanai

ASKER

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.
Sorry I can't Figure the Way.
myShanai:
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 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
ASKER CERTIFIED SOLUTION
Avatar of myShanai
myShanai

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial