Incrementing a field without using autonumber

G

Guest

I'm new to Access and need to increment a long number field. I built a test
database called Order test with two fields, Key name and Next seq and have
been trying to increment Next seq by using the Expression builder. I put in
the following:
=DMax([Next seq],"Order test")+1.

I get no values as a result. I've also tried various forms of Count without
success.

I'd appreciate any help I could get.
 
L

Larry Linson

_Where_ did you put in the
=DMax([Next seq],"Order test")+1.

that "didn't work" and, while we are asking for clarification, exactly _how_
did it not work, that is, _what_ were the symptoms of it "not working."

If you put that in the Control Source field, how did you think you were
specifying the field into which it would be stored? If you put that into
appropriate event code, it should retrieve the largest value of the Next seq
Field of table "Order test", increment it by one, and return the value.
It'd be up to you to make sure that value is stored into the appropriate
Field in the Record.

Larry Linson
Microsoft Access MVP

Procrustes said:
I'm new to Access and need to increment a long number field. I built a
test
database called Order test with two fields, Key name and Next seq and have
been trying to increment Next seq by using the Expression builder. I put
in
the following:
=DMax([Next seq],"Order test")+1.

I get no values as a result. I've also tried various forms of Count
without
success.

I'd appreciate any help I could get.
 
G

Guest

Thank you for responding.

My first attempt was to right click 'Next seq', select Expression Builder
and entering the formula. It produced nothing, no error, no message.

Based on your response, I right clicked on 'Next seq', selected Properties,
Data, entered the formula in Default value and saved. On data entry, I got
'#Error' in the Next seq field.

Larry Linson said:
_Where_ did you put in the
=DMax([Next seq],"Order test")+1.

that "didn't work" and, while we are asking for clarification, exactly _how_
did it not work, that is, _what_ were the symptoms of it "not working."

If you put that in the Control Source field, how did you think you were
specifying the field into which it would be stored? If you put that into
appropriate event code, it should retrieve the largest value of the Next seq
Field of table "Order test", increment it by one, and return the value.
It'd be up to you to make sure that value is stored into the appropriate
Field in the Record.

Larry Linson
Microsoft Access MVP

Procrustes said:
I'm new to Access and need to increment a long number field. I built a
test
database called Order test with two fields, Key name and Next seq and have
been trying to increment Next seq by using the Expression builder. I put
in
the following:
=DMax([Next seq],"Order test")+1.

I get no values as a result. I've also tried various forms of Count
without
success.

I'd appreciate any help I could get.
 

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