default value in form

  • Thread starter Thread starter jem53
  • Start date Start date
J

jem53

hello,

i have a form for entering new product. i have been trying
to use the expression builder to fill in the new product
IDnumber field......haven't got a clue what to do but this
the result i would like:

new IDnumber =maximum IDnumber+1

not sure if this is enough info. hoping for the best!

jem53
 
Hello:

What about making this field an AutoNumber field?

In Table Design make the field type "AutoNumber".

Regards,

Naresh Nichani
Microsoft Access MVP
 
Jem,

I agree with Naresh that an Autonumber may be a good solution.
However, if you want to ensure the numbering will anways be continuous
and sequential, your way may be better. In this case, you can use the
Default Value property of the IDnumber control on the form, setting it
to the equivalent of...
DMax("[Idnumber]","NameOfYourTable")+1

- Steve Schapel, Microsoft Access MVP
 
thanks to you both for your time with this problem. i
also agree that an autonumber would have been the answer.
unfortunately the existing (pre database) IDnumbers were
not asigned in a sequencial manner. if i apply an
autonumber field to the items now it would change the
original numbers. steve's suggestion did the trick!
thanks again, jem
-----Original Message-----
Jem,

I agree with Naresh that an Autonumber may be a good solution.
However, if you want to ensure the numbering will anways be continuous
and sequential, your way may be better. In this case, you can use the
Default Value property of the IDnumber control on the form, setting it
to the equivalent of...
DMax("[Idnumber]","NameOfYourTable")+1

- Steve Schapel, Microsoft Access MVP


Hello:

What about making this field an AutoNumber field?

In Table Design make the field type "AutoNumber".

Regards,

Naresh Nichani
Microsoft Access MVP

.
 
Jem,

Actually, you are wrong about the autonumber. You could have made a
new table with the same structure as the existing table, except with
the ID as an Autonumber data type, and then used an Append Query to
transfer the data from the old table to the new. In this case, the
present ID numbers would be preserved, and the ID for new records
would automatically start at 1 greater than the hightest existing
value.

- Steve Schapel, Microsoft Access MVP
 
Back
Top