From: Bre-x on
How do I create my autoincrement number?

My Table

main_index (AutoNumber),
payee_id (Number),
main_amount (Currency),
main_receipt (Number)

if my Last Receipt Number was 500, I would like to update my main_receipt
with the next number
501, 502, 503, etc, etc, according th main_idex field.


Thank you all,

Bre-x




From: Jeff Boyce on
If you are using Access' Autonumber data type, be aware that it is ONLY
designed to provide a unique identifier. It is not guaranteed to be
sequential, and is generally unfit for human consumption.

If you MUST have a sequential number (i.e., a "sequence number"), you'll
need to 'roll your own' code to generate it. Check online for "custom
autonumber" for variations on how to do this.

Note, you can keep your Autonumber primary key, but you'll need to add a
numeric-type field to hold your (new) sequence number.

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"Bre-x" <cholotron(a)hotmail.com> wrote in message
news:u0t93FH7KHA.5112(a)TK2MSFTNGP02.phx.gbl...
> How do I create my autoincrement number?
>
> My Table
>
> main_index (AutoNumber),
> payee_id (Number),
> main_amount (Currency),
> main_receipt (Number)
>
> if my Last Receipt Number was 500, I would like to update my main_receipt
> with the next number
> 501, 502, 503, etc, etc, according th main_idex field.
>
>
> Thank you all,
>
> Bre-x
>
>
>
>


From: Bre-x on
I coundn't find what I am looking for, most of the instructions are to reset
the autonumber.
I am looking for a way to auto increment a field.

After a few hundred records have been inserted I need to find a way to auto
increase the
main_receipt starting from a number in another table.

Help!!!!!!

Bre-x



"Jeff Boyce" <nonsense(a)nonsense.com> wrote in message
news:%23ki8XKH7KHA.5112(a)TK2MSFTNGP02.phx.gbl...
> If you are using Access' Autonumber data type, be aware that it is ONLY
> designed to provide a unique identifier. It is not guaranteed to be
> sequential, and is generally unfit for human consumption.
>
> If you MUST have a sequential number (i.e., a "sequence number"), you'll
> need to 'roll your own' code to generate it. Check online for "custom
> autonumber" for variations on how to do this.
>
> Note, you can keep your Autonumber primary key, but you'll need to add a
> numeric-type field to hold your (new) sequence number.
>
> Regards
>
> Jeff Boyce
> Microsoft Access MVP
>
> --
> Disclaimer: This author may have received products and services mentioned
> in this post. Mention and/or description of a product or service herein
> does not constitute endorsement thereof.
>
> Any code or pseudocode included in this post is offered "as is", with no
> guarantee as to suitability.
>
> You can thank the FTC of the USA for making this disclaimer
> possible/necessary.
>
> "Bre-x" <cholotron(a)hotmail.com> wrote in message
> news:u0t93FH7KHA.5112(a)TK2MSFTNGP02.phx.gbl...
>> How do I create my autoincrement number?
>>
>> My Table
>>
>> main_index (AutoNumber),
>> payee_id (Number),
>> main_amount (Currency),
>> main_receipt (Number)
>>
>> if my Last Receipt Number was 500, I would like to update my main_receipt
>> with the next number
>> 501, 502, 503, etc, etc, according th main_idex field.
>>
>>
>> Thank you all,
>>
>> Bre-x
>>
>>
>>
>>
>
>


From: John W. Vinson on
On Wed, 5 May 2010 10:39:00 -0600, "Bre-x" <cholotron(a)hotmail.com> wrote:

>How do I create my autoincrement number?
>
>My Table
>
>main_index (AutoNumber),
>payee_id (Number),
>main_amount (Currency),
>main_receipt (Number)
>
>if my Last Receipt Number was 500, I would like to update my main_receipt
>with the next number
>501, 502, 503, etc, etc, according th main_idex field.

If (as you should!) you are doing your data entry through a Form, you can put
code in the form's BeforeInsert event:

Private Sub Form_BeforeInsert(Cancel as Integer)
Me!main_receipt = NZ(DMax("[main_receipt]", "[yourtablename]")) + 1
End Sub

You may want to consider that main_index and main_receipt are now functionally
equivalent (both are Long Integer unique identifiers for the record); you
could consider making main_receipt the Primary Key and removing the autonumber
field altogether. This will require some snarky update queries if you have
related tables, however.

--

John W. Vinson [MVP]
From: KenSheridan via AccessMonster.com on
Roger Carlson has simple solutions for both single and multi-user
environments at:

http://www.rogersaccesslibrary.com/forum/topic395.html

while my slightly more complex solution at:

http://community.netscape.com/n/pfx/forum.aspx?nav=libraryMessages&tsn=1&tid=23839&webtag=ws-msdevapps


also allows the number to be 're-seeded' with a number at which the sequence
will re-start when the next record is added. This could be adapted to re-
start the sequence with your number from another table.

Ken Sheridan
Stafford, England

Bre-x wrote:
>I coundn't find what I am looking for, most of the instructions are to reset
>the autonumber.
>I am looking for a way to auto increment a field.
>
>After a few hundred records have been inserted I need to find a way to auto
>increase the
>main_receipt starting from a number in another table.
>
>Help!!!!!!
>
>Bre-x
>
>> If you are using Access' Autonumber data type, be aware that it is ONLY
>> designed to provide a unique identifier. It is not guaranteed to be
>[quoted text clipped - 28 lines]
>>>
>>> Bre-x

--
Message posted via http://www.accessmonster.com