DMax - incremental numbering

G

Guest

I use DMax("ReceiptNo", "ReceiptsTable")+1 to sequentually number receipt
input, to save the user from the need to input each receipt No.
When however a new receipt book series begins again from '1', the above DMax
continues to input the last highest receipt No.

I need the user to be able to over-ride the DMax auto number, and then for
DMax to continue on using that latest input number as its base.

I've tried using 'DLast' but that appears to be the same as 'DMax'. Perhaps
I should be using the 'Criteria' argument, but can't fathom how to do that.

Any help will be appreciated
 
R

Rick Brandt

Glynn said:
I use DMax("ReceiptNo", "ReceiptsTable")+1 to sequentually number
receipt input, to save the user from the need to input each receipt
No.
When however a new receipt book series begins again from '1', the
above DMax continues to input the last highest receipt No.

I need the user to be able to over-ride the DMax auto number, and
then for DMax to continue on using that latest input number as its
base.

I've tried using 'DLast' but that appears to be the same as 'DMax'.
Perhaps I should be using the 'Criteria' argument, but can't fathom
how to do that.

Any help will be appreciated

Yes, whatever data in your records indicates a specific "receipt book" needs to
be included in the third WHERE argument of DMax(). Currently you are finding
"the highest ReceiptNo". You need to be finding "the highest ReceiptNo in a
particular receipt book". Adding the WHERE clause you your DMax() will do that
for you.
 
L

Larry Daugherty

One solution is to create a table for user options. The records in
that table would have a field for OptionName, a field for OptionValue
and a field for OptionDescription.

Give your option a name such as ReceiptSequence.

Make the default value for the control on the form a DLookup on the
value of ReceiptSeqValue + 1

In the AfterUpdate event for the form store the new value back into
the options table.

HTH
 

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