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 February 23rd, 2009, 01:07 PM posted to microsoft.public.access.tablesdbdesign
FLGuy
external usenet poster
 
Posts: 8
Default AutoNumber

I am converting a database from 2002 to 2007. The old databases first record
started out at 700. I would like to renumber these records starting at 1.
Then I would like to set AutoNumber to start with the number of the last
record. Is this possible to do? If so how would I go about doing this?
  #2  
Old February 23rd, 2009, 02:08 PM posted to microsoft.public.access.tablesdbdesign
Rod Plastow
external usenet poster
 
Posts: 195
Default AutoNumber

Hi,

Is the existing (v2002) data type also Autonumber? Is this a primary key
(or a foreign key come to that)? Are there any relationships from this
number to other tables? If so, is Cascade Update set for these relationships?

The answers will help me or others suggest a course of action.

"FLGuy" wrote:

I am converting a database from 2002 to 2007. The old databases first record
started out at 700. I would like to renumber these records starting at 1.
Then I would like to set AutoNumber to start with the number of the last
record. Is this possible to do? If so how would I go about doing this?

  #3  
Old February 23rd, 2009, 02:33 PM posted to microsoft.public.access.tablesdbdesign
Keith Wilby
external usenet poster
 
Posts: 812
Default AutoNumber

"FLGuy" wrote in message
...
I am converting a database from 2002 to 2007. The old databases first
record
started out at 700. I would like to renumber these records starting at 1.
Then I would like to set AutoNumber to start with the number of the last
record. Is this possible to do? If so how would I go about doing this?


An AutoNumber field is for internal indexing purposes and should be
transparent and meaningless to the developer and user alike. If you want to
number your records consecutively then consider using the DMax function as
the default value of a field:

nz(DMax("MyField","tblMyTable")+1,1)

Keith.
www.keithwilby.co.uk

  #4  
Old February 23rd, 2009, 04:26 PM posted to microsoft.public.access.tablesdbdesign
FLGuy
external usenet poster
 
Posts: 8
Default AutoNumber

The existing data type in (v2002) is an Autonumber field. This feild is not a
primary key or a foreign key. It is used to generate a ticket number for each
issue loged into the database. No, there are no relationships from this
number to any other table in the database.

"Rod Plastow" wrote:

Hi,

Is the existing (v2002) data type also Autonumber? Is this a primary key
(or a foreign key come to that)? Are there any relationships from this
number to other tables? If so, is Cascade Update set for these relationships?

The answers will help me or others suggest a course of action.

"FLGuy" wrote:

I am converting a database from 2002 to 2007. The old databases first record
started out at 700. I would like to renumber these records starting at 1.
Then I would like to set AutoNumber to start with the number of the last
record. Is this possible to do? If so how would I go about doing this?

  #5  
Old February 24th, 2009, 09:04 AM posted to microsoft.public.access.tablesdbdesign
Keith Wilby
external usenet poster
 
Posts: 812
Default AutoNumber

"FLGuy" wrote in message
...
The existing data type in (v2002) is an Autonumber field. This feild is
not a
primary key or a foreign key. It is used to generate a ticket number for
each
issue loged into the database. No, there are no relationships from this
number to any other table in the database.


You do realise that you can't rely on AutoNumber to be sequential don't you?
Do you care that there might be gaps in the numbering? How would you tell
the difference between a gap in the numbering and a record that did exist
and has been deleted? Do none of these issues concern you?

Keith.

  #6  
Old February 24th, 2009, 12:51 PM posted to microsoft.public.access.tablesdbdesign
FLGuy
external usenet poster
 
Posts: 8
Default AutoNumber

Yes, I realise that the numbering my not be sequential. I am just using it to
create a unique number for each record. As for gaps because of records being
deleted. This is not a concern for me because nobody has access to delete
records except for me.


"Keith Wilby" wrote:

"FLGuy" wrote in message
...
The existing data type in (v2002) is an Autonumber field. This feild is
not a
primary key or a foreign key. It is used to generate a ticket number for
each
issue loged into the database. No, there are no relationships from this
number to any other table in the database.


You do realise that you can't rely on AutoNumber to be sequential don't you?
Do you care that there might be gaps in the numbering? How would you tell
the difference between a gap in the numbering and a record that did exist
and has been deleted? Do none of these issues concern you?

Keith.


  #7  
Old February 24th, 2009, 01:46 PM posted to microsoft.public.access.tablesdbdesign
Keith Wilby
external usenet poster
 
Posts: 812
Default AutoNumber

"FLGuy" wrote in message
...
Yes, I realise that the numbering my not be sequential. I am just using it
to
create a unique number for each record. As for gaps because of records
being
deleted. This is not a concern for me because nobody has access to delete
records except for me.



All I can do is re-state the case for using DMax plus 1 in an ordinary
number field. It's *exactly* what you need based on your OP. You can
renumber your existing records using an update query and then DMax will
provide the next available number sequentially.

Keith.

  #8  
Old February 24th, 2009, 02:20 PM posted to microsoft.public.access.tablesdbdesign
BruceM[_2_]
external usenet poster
 
Posts: 1,763
Default AutoNumber

There will almost surely be gaps, regardless of whether records are deleted.
For instance, if you go to a new record, then navigate away from it, Access
regards the number as having been used, even though there is no record with
that number. That may not be a problem, but it is worth pointing out, I
think.


"FLGuy" wrote in message
...
Yes, I realise that the numbering my not be sequential. I am just using it
to
create a unique number for each record. As for gaps because of records
being
deleted. This is not a concern for me because nobody has access to delete
records except for me.


"Keith Wilby" wrote:

"FLGuy" wrote in message
...
The existing data type in (v2002) is an Autonumber field. This feild is
not a
primary key or a foreign key. It is used to generate a ticket number
for
each
issue loged into the database. No, there are no relationships from this
number to any other table in the database.


You do realise that you can't rely on AutoNumber to be sequential don't
you?
Do you care that there might be gaps in the numbering? How would you
tell
the difference between a gap in the numbering and a record that did exist
and has been deleted? Do none of these issues concern you?

Keith.



 




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 11:29 AM.


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