Solved

Counter in Datareport

Posted on 2001-08-26
12
302 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 69

Expert Comment

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

Author Comment

by:falconew
Comment Utility
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 69

Expert Comment

by:Éric Moreau
Comment Utility
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
 
LVL 1

Expert Comment

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

Author Comment

by:falconew
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 1

Author Comment

by:falconew
Comment Utility
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
Comment Utility
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
Comment Utility
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 69

Accepted Solution

by:
Éric Moreau earned 100 total points
Comment Utility
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
Comment Utility
hey thanx, that really helped me alot, and it's not even my question :P

:)
0
 
LVL 1

Author Comment

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

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…

763 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now