A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

AutoNumber



 
 
Thread Tools Display Modes
  #1  
Old June 22nd, 2004, 05:30 PM
Charlie
external usenet poster
 
Posts: n/a
Default AutoNumber

I need an autonumber field to be incrimented by more than
1. I would like it incrimented by 5 on each new record. I
use the autonumber to give me import order in a invoice
database. If i want to add a row to the invoice i can't
do so beacause the autonumbers are 1,2,3,4,5 for eg and I
cant' use 1.1, 1.2,1.3. etc.
How do I do this?
  #2  
Old June 22nd, 2004, 05:54 PM
Tim Ferguson
external usenet poster
 
Posts: n/a
Default AutoNumber

"Charlie" wrote in
:

I need an autonumber field to be incrimented by more than
1. I would like it incrimented by 5 on each new record. I
use the autonumber to give me import order in a invoice
database. If i want to add a row to the invoice i can't
do so beacause the autonumbers are 1,2,3,4,5 for eg and I
cant' use 1.1, 1.2,1.3. etc.


"If you care what value an Autonumber has, then you probably should not be
using an Autonumber"

If you want to control the allocation of unique numbers you need to do it
yourself in code. Try googling for "Access Custom Autonumbers"

B Wishes


Tim F

  #3  
Old June 22nd, 2004, 06:55 PM
John Vinson
external usenet poster
 
Posts: n/a
Default AutoNumber

On Tue, 22 Jun 2004 09:30:09 -0700, "Charlie"
wrote:

I need an autonumber field to be incrimented by more than
1. I would like it incrimented by 5 on each new record. I
use the autonumber to give me import order in a invoice
database. If i want to add a row to the invoice i can't
do so beacause the autonumbers are 1,2,3,4,5 for eg and I
cant' use 1.1, 1.2,1.3. etc.
How do I do this?


Don't use an Autonumber field AT ALL for this purpose (it cannot be
edited, for one thing, so you wouldn't be able to insert records in
between existing records anyway).

I'd suggest using a Form for all your data entry (table datasheets
don't provide any usable events). I presume you have an invoice main
table related one-to-many to a Details table? If so, on the Details
subform's BeforeUpdate event, invoke the Code Builder by clicking the
.... icon and put code like

Private Sub Form_BeforeInsert()
Me!txtLineNo = NZ(DMax("[LineNo]", "[Details]", _
"[InvoiceID] = " & Me!txtInvoiceID)) + 5
End Sub


John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public
  #4  
Old June 22nd, 2004, 08:35 PM
Roger Carlson
external usenet poster
 
Posts: n/a
Default AutoNumber

On my website (see sig below) is a small sample database called
"AutonumberProblem.mdb" which illustrates a solution much like John's.

--
--Roger Carlson
www.rogersaccesslibrary.com
Reply to: Roger dot Carlson at Spectrum-Health dot Org

"Charlie" wrote in message
...
I need an autonumber field to be incrimented by more than
1. I would like it incrimented by 5 on each new record. I
use the autonumber to give me import order in a invoice
database. If i want to add a row to the invoice i can't
do so beacause the autonumbers are 1,2,3,4,5 for eg and I
cant' use 1.1, 1.2,1.3. etc.
How do I do this?



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:53 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.