Solved

Counter in Datareport

Posted on 2001-08-26
12
315 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
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 100 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Determine Range to Select 5 64
Adding to a VBA? 6 92
Help with Classic ASP - Parameterizing Query 16 65
Excel Macro: Correct Macro that creates tabs for each "AccountSku" 4 51
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

751 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