increase the counter by one

  • Thread starter Thread starter Ravi Sharma
  • Start date Start date
R

Ravi Sharma

Thanks for reading the post.

I need serial number to appear by itself in every new record. I mean when I
add new record the value in serial number field should be +1 of value of
same field in previous record.

Please help me solve this. Thank you.
 
Thanks for reading the post.

I need serial number to appear by itself in every new record. I mean when I
add new record the value in serial number field should be +1 of value of
same field in previous record.

Please help me solve this. Thank you.

Set the default value property of the field to:
=DMax("ThisFieldName]","TableName")+1
 
If you are starting with a field that contains no records,
you probably want to use Nz(DMax
("ThisFieldName]","TableName"))+1 to convert the initial
null value to a zero (in a number field).
-----Original Message-----
Thanks for reading the post.

I need serial number to appear by itself in every new record. I mean when I
add new record the value in serial number field should be +1 of value of
same field in previous record.

Please help me solve this. Thank you.

Set the default value property of the field to:
=DMax("ThisFieldName]","TableName")+1
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
.
 
Simplest way is to get the max value of that field and ad 1 to it. Yo
can use DMAX to do that. Pitfall is if this is a shared DB, and tw
poeple do it at the same time, you could possibly duplicate a SN. Bu
if it is a +1, why not just create an autonumber field to generate i
for you
 
Simplest way is to get the max value of that field and ad 1 to it. Yo
can use DMAX to do that. Pitfall is if this is a shared DB, and tw
poeple do it at the same time, you could possibly duplicate a SN. Bu
if it is a +1, why not just create an autonumber field to generate i
for you
 
not accepting sir, i keyed it in property of default value in design view of
table. please advice.
fredg said:
Thanks for reading the post.

I need serial number to appear by itself in every new record. I mean when I
add new record the value in serial number field should be +1 of value of
same field in previous record.

Please help me solve this. Thank you.

Set the default value property of the field to:
=DMax("ThisFieldName]","TableName")+1
 
not accepting sir, i keyed it in property of default value in design view of
table. please advice.

Use a Form, and put it in the default value of the textbox. Table
Default properties cannot reference any table field nor can they call
a custom function.
 
Back
Top