NUMERO field in table1

G

Gianmarco

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
 
M

mikejs2000

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
 
G

Gianmarco

Can u add here the code?

I am an apprentice.

The table is TABLE and the field is called NUMERO.
 
G

Gianmarco

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.
 
K

Klatuu

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
 

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