Autonumber function?

wotamelon

Registered User.
Local time
Today, 09:15
Joined
Jul 28, 2010
Messages
38
Is there a function for auto number?

eg. Current time: =Now()


How abt one for auto number?
 
Have a look at the Dmax() function. You can us Dmax() +1 to create a custom auto incrementing number.

Check the attached for a practical example.
 

Attachments

Have a look at the Dmax() function. You can us Dmax() +1 to create a custom auto incrementing number.

Check the attached for a practical example.

YAY! ur a champ, always helpful
 
You can also make an autonumber on table level by setting the column type to Autonumber
 
You can also make an autonumber on table level by setting the column type to Autonumber

3910996
Ah of course I had assumed the OP was looking for Customs Auto Number.
 
Ok, I don't understand the ''Criteria''


DMax ( expression, domain, [criteria] )

I've got expression and domain. what's the criteria referring to? and why is it a number and what for?
 
nono, i am looking for a customise autonumber to create a continous invoice number flow
 
Ok, I don't understand the ''Criteria''


DMax ( expression, domain, [criteria] )

I've got expression and domain. what's the criteria referring to? and why is it a number and what for?
From the link I provided;
Code:
criteria is optional. It is the WHERE clause to apply to the domain.
 
You could use the Criteria argument to have a number of different auto incrementing number based on say the ClientID so that each client could have their own series of Invoice number.
 
this is the function in my txtbox

="TAX INVOICE #M1" & (Nz(DMax("INV","InvoiceNumber")+1))

It's currently sitting in my txtbox in my report.

The report is generated based on query (criteria is that I enter first name and last name of customer)

but when i gen the report, it's always with the same invoice number, even when i view all report. it's still the same invoice number
 
If your using;
Code:
="TAX INVOICE #M1" & (Nz(DMax("INV","InvoiceNumber")+1))
INV Should be a Field in table InvoiceNumber

Your code should probably look like;
Code:
="TAX INVOICE #M1" & (Nz(DMax("INV","InvoiceNumber"),666)+1)
Where 666 represents your seed number, this should be your intended start number less 1, so in the example I've given here the first number in the invoice sequence will be 667 and would show as TAX INVOICE #M1667
 
Last edited:
Sorry Just notice a flaw in the sample, there is no check to ensure that a record that already has a number is not reassigned the next number in the sequence. This can be rectified by changing the Form's On Current event to;
Code:
    If Me.Counter = 0 Then
          Me.Counter = Nz(DMax("Counter", "Table1"), 9910079) + 1
    End If
 
but then when i generate the report, it's all coming up as the same invoice number.

the invoice number textbox is in my PAGE HEADER in REPORT
 
The way I would do this is to have a form that represents you Invoice, and button on the form to allow the invoice to be printed. That way each time you you go to a new record you will in effect be generating a new invoice, with an associated new Invoice Number.
 

Users who are viewing this thread

Back
Top Bottom