View Single Post
  #1 (permalink)  
Old May 6th, 2006, 01:19 AM
Bob Hansen Bob Hansen is offline
Authorized User
 
Join Date: May 2004
Location: , NH, USA.
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Default Line Item Numbers needed

Using a sub form to add line items to an order, want a line item number as a reference. The table for the subform has a field to store the value. Right now the line item is being entered manually for each line. How to assign this value automatically?

Hmmmm, maybe keep an invisible counter on the main form, start at 1, and increment every a record is saved in the subform? Then when new line is entered, get that value, add one and put result into field for line item, and update value on parent form? Would need to update Parent form only when sub form record is actually saved?

Yes, I think I may have just solved my own problem. Add a field to table for parent form that is LineItemCount.Put an invisible text box on parent that is bound to the LineItemCount. Will also need to find a way with handling deleting records in subform. Want to keep original line item numbers, so this should be OK, deleted records will leave gaps, but can still sort by LineItem number.

Thanks for listening.
I am still open to a known working method if you can share that with us.......