Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

auto increment code 1

Status
Not open for further replies.

SamLN

Technical User
Apr 17, 2013
25
AU
Hi,
I have been asked to create a report with a feature that i am not sure how to achieve.

we are reporting on position codes and often there is more than one employee using the same position code as another.

I have been asked to auto increment any position code which appears more than once.

so: pos code ERT001 shown initially - then any further incidents of ERT001 are marked as ERT001/1, ERT001/2, ERT001/3 etc.

Any thoughts on how I can achieve this?

Thanks
Sam
 
The approach here will depend on the structure of the report.

Assuming no grouping, and records sorted so that all of the records with the same "Position Code" are listed consecutively, the following will work:

1. Create a Running Total ({#RT}) to Count the records (any field), Evaluate for every record, Reset on change of {Table.Posn_Code};

2. Create the following formula:
Code:
If      OnFirstRecord
Then    {Table.Posn_Code}
Else
If      {Table.Posn_Code} = Previous({Table.Posn_Code})
Then    {Table.Posn_Code} + '/' + ToText({#RT}, '#')
Else    {Table.Posn_Code}

Hope this helps.

Cheers
Pete
 
Thanks Pete, I anticipate that records will be sorted by Position number, hopefully wont require grouping either.
appreciate your reply and will create report as per your suggestions and see how I go!
Thanks again, Sam.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top