Reset counter in subform

H

huzefahashim

Hi,
I am trying to make a database for invoices generated. Within each
invoice, is another table with the invoice details. Both tables are
linked. When a user enters data for an invoice, I would like the
subform (the invoice details) to enter the counter for each new
record.
For example, Invoice A has 3 items and Invoice B has 5 items. When the
user enters Invoice A and enters those 3 items within the form, there
is an autonumber which shows the numbers 1 to 3 (or more, if there are
more entries.
When the user starts entering data for Invoice B, the counter starts
from 4 (because there are already 3 items in the 'Invoice Details'
table. How can I set it to start the counter from 1 everytime a new
invoice is being created?
 
S

storrboy

If the numbers staying in order is important, don't use AutoNumber.
You'll have to make your own incremental number system. Autonumbers
are not intended to mean anything. By definition they are
*auto*matically generated, not constantly manipulated or customized.
 
H

huzefahashim

If the numbers staying in order is important, don't use AutoNumber.
You'll have to make your own incremental number system. Autonumbers
are not intended to mean anything. By definition they are
*auto*matically generated, not constantly manipulated or customized.

And how do I do that? i.e. make my own incremental number system?
 
S

storrboy

You'd have to create a method of determining the last number used and
incrementing it by a determined amount. The exact method may be
dependant on the circumstances, but it could be as simple as creating
a function that uses the DMax function to get the largest number used
in a table, adding one and assigning the new number to the record
currently being saved.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top