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

x
?
Solved

Counter in Datareport

Posted on 2001-08-26
12
Medium Priority
?
324 Views
Last Modified: 2008-10-16
How to make a counter in the Datareport, so counter will be displayed as an order number in the report. I also need the counter can be reset everytime the header changes.
0
Comment
Question by:falconew
  • 5
  • 4
  • 3
12 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 6428273
An Identity field (or AutoNumber in Access) can help you.
0
 
LVL 1

Author Comment

by:falconew
ID: 6430423
Thanks for your response. The problem is my database does not have the identity field. And I just want to display the ordered number for details and everytimes the header changes the number would be reset.
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 6430431
Create a new dummy table that will give you invoice number.

If you print invoice number, you should keep them somewhere in your database so that if your customer reference it, you can have a way to find it!
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 1

Expert Comment

by:raybeam
ID: 6431222
use a count RptFunction Control in data report in the Header Footer
0
 
LVL 1

Author Comment

by:falconew
ID: 6435062
The number has nothing to do with the database. I just need the number will displayed in the report details as the ordered number to indicate which line it is. For example:

Customer ID: 1001   --> (this the header)
=================
No.         Order ID       Product ID  
=====================================
 1.          A001          bla bla      -> (this the detail)
 2.          B323          vla bla
 .
 .
 etc.

so I just need the field "No." to be count up until the end of details. And it need to be reset if the customer ID has changed. The field No. is not in the database.

Any help or suggestion would be greatly appreciated.
0
 
LVL 1

Expert Comment

by:raybeam
ID: 6436002
put a temp field in the orders table and run a procedure to fill it before you open the datareport...it's an easy trick...
0
 
LVL 1

Author Comment

by:falconew
ID: 6443288
I don't think it is easy and efficient to do that, because we need a logic programming for numbering the details.
0
 
LVL 1

Expert Comment

by:raybeam
ID: 6443701
The procedure is as follow:

1-Execute the same query you'r gonna execute to fetch the report data in a VB Module (Use connection object)
Example
{
Dim I AS Integer
I = 0
Set rs = cn.execute("SAME QUERY TO FILL REPORT")
Do While Not rs.EOF
   cn.execute("UPDATE OrderTable SET Rank = " & I " & WHERE Order_ID = " & rs("Order_ID")  
   I = I  + 1
   rs.movenext
Loop
}

Order_ID is the Order Identity field you create as primary key for the orders table
0
 
LVL 1

Expert Comment

by:raybeam
ID: 6444335
also u should use another Recordset right above the order one for customers

SET CustRS = cn.execute("SELECT * FROM CustomerTable WHERE [CRITERIA]")

so the 2nd query should be something like

SET rs = cn.execute("SELECT * FROM OrdersTable WHERE Customer_ID = " & CustRS("Customer_ID"))

0
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 400 total points
ID: 6444394
I just found an article that may interest you: "INF: How to Dynamically Number Rows in a Select Statement" at http://support.microsoft.com/support/kb/articles/q186/1/33.asp
0
 
LVL 1

Expert Comment

by:raybeam
ID: 6446577
hey thanx, that really helped me alot, and it's not even my question :P

:)
0
 
LVL 1

Author Comment

by:falconew
ID: 6447228
Thanks emoreau. It's actually I was looking for.
I also thank for raybeam for the suggestion.
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month11 days, 4 hours left to enroll

572 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