fake Autonumber

E

Emma

Hi I already have an autonumber in my table and would like to have a second
one just for certain items. Can I use the following somewhere in the table's
definition:
dmax("FieldName", "TableName") + 1
 
T

Tom van Stiphout

On Tue, 18 May 2010 07:08:03 -0700, Emma

Try setting that as the Default Value for the field.

-Tom.
Microsoft Access MVP
 
E

Emma

Unfortunately it doesn't like dmax

Tom van Stiphout said:
On Tue, 18 May 2010 07:08:03 -0700, Emma

Try setting that as the Default Value for the field.

-Tom.
Microsoft Access MVP


.
 
J

John W. Vinson

Hi I already have an autonumber in my table and would like to have a second
one just for certain items. Can I use the following somewhere in the table's
definition:
dmax("FieldName", "TableName") + 1

No. A Table cannot contain expressions, and its default value cannot reference
any other field in the table. You'll need to do this on a Form.
 
S

Steve

Your question hints at your tables are not designed correctly. Take a look
at the design of your tables and mayne you will find you don't need a fake
autonumber. If you like, posy your tables here and we will advise you.

Steve
[email protected]
 
T

Tom van Stiphout

On Tue, 18 May 2010 08:53:01 -0700, Emma

Oops I was mistaken and John was right. Use the expression builder and
you will see what you can and cannot do.
Populating this field in the associated form may be your best bet.

-Tom.
Microsoft Access MVP
 
D

David W. Fenton

[in re: expressions as default values]
Oops I was mistaken and John was right. Use the expression builder
and you will see what you can and cannot do.

But doesn't the A2010 table-level data macro change this? You can
now have your custom Autonumber run at the engine level using one,
right?

Looks like a big win to me.
 
Top