NUMERO field in table1

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

This NUMERO field is a number field and it's not a counter field. When i
create e new record it must become "last number record+1"

Example:

If the last record inserted has NUMERO = 135
When i create a new record, the field NUMERO must be automatically
completed with the number 136. And go straight with this progressive
numeration.

I hope i explain correctly my question. Thanks
 
Hi Gianmarco

I did this a while ago buy having a field in a table that contained the
number of the last record, when a user clicks the Add New record the system
looked at this field took the number and then added one to it before placing
it into the relievant control on the form. To get the number from the table
use the Dlookup function.
One benifit of this is than when you close the system the last record number
is safe in its table ready for the next time.

Hope this helps

Mike J. Soames
 
Can u add here the code?

I am an apprentice.

The table is TABLE and the field is called NUMERO.
 
SORRY, WHERE I MUST PUT THIS CODE?? iN WICH EVENT OF THE FORM?

Klatuu said:
NUMERO = Nz(DMax("[NUMERO]", "TableNameHere"),0) +1

Gianmarco said:
Can u add here the code?

I am an apprentice.

The table is TABLE and the field is called NUMERO.
 
Put it in the form's Current Event:

If Me.NewRecord Then
NUMERO = Nz(DMax("[NUMERO]", "TableNameHere"),0) +1
End If

Gianmarco said:
SORRY, WHERE I MUST PUT THIS CODE?? iN WICH EVENT OF THE FORM?

Klatuu said:
NUMERO = Nz(DMax("[NUMERO]", "TableNameHere"),0) +1

Gianmarco said:
Can u add here the code?

I am an apprentice.

The table is TABLE and the field is called NUMERO.

:

Hi Gianmarco

I did this a while ago buy having a field in a table that contained the
number of the last record, when a user clicks the Add New record the system
looked at this field took the number and then added one to it before placing
it into the relievant control on the form. To get the number from the table
use the Dlookup function.
One benifit of this is than when you close the system the last record number
is safe in its table ready for the next time.

Hope this helps

Mike J. Soames

:

This NUMERO field is a number field and it's not a counter field. When i
create e new record it must become "last number record+1"

Example:

If the last record inserted has NUMERO = 135
When i create a new record, the field NUMERO must be automatically
completed with the number 136. And go straight with this progressive
numeration.

I hope i explain correctly my question. Thanks
 
Back
Top