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!

Order Detail Lines

Status
Not open for further replies.

cobweb

IS-IT--Management
May 5, 2002
95
GB
Hi:
Running VFP8 I am trying to write an ordering system.
What I want is the order detail to have a unique and ascending line number - that resets for each order.
So order 1234 can have lines 1,2,3
So order 1235 can have lines 1,2,3 - not 4, 5, 6 which AutoInc will do!
In other words can I reset AutoInc for each order? Or do I ned to do something else?

Thanks!
 

Cobweb,

Are you generating the detail lines at the same time as you are creating the orders? If so, it should be possible to maintain a variable that always holds the next detail line number to be assigned. When you add a detail line, add one to the variable. When you start a new order, reset the variable to one.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
The AUTOINC attribute is intended for generating unique surrogate keys. It's not meant for what you're trying to do, and won't do that.

I recommend you give each detail line a single-field primary key, even if you also choose to give them a sequence number within the invoice.

Tamar
 

cobweb,

Are you talking about enumerating detail lines in report? You didn't say it's a report, but it looks like it.

If it is so, you can create a group for orders, so each new order number will reset a group. Then create a report variable that will reset with this group, and calculate count. Put it as a field in the detail band where you want the count to go. It should do what you want it to do.

Stella

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top