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  

Autonum problem



 
 
Thread Tools Display Modes
  #1  
Old June 15th, 2008, 06:31 PM posted to microsoft.public.access.tablesdbdesign
Cathy
external usenet poster
 
Posts: 253
Default Autonum problem

I have an autonum field in table1 that is the relational field to table2. It
is an indexed field in table1 that will not allow duplicates, but is not the
primary key. I need to add and delete records from both table from time to
time. Recently I ran into a problem when I needed to add several records to
table1. The append query kept trying to reuse a deleted autonum and would
error out. I had to rebuild the tables to make the process move forward
again. Why would it attempt to reuse a number instead of choosing the next
highest number? Right now I don't have a lot of records so it wasn't too
much of a problem. It will be a problem if it does it again in the future.
How can I prevent this error from happening in the future?

Thank you,
Cathy
  #2  
Old June 15th, 2008, 09:15 PM posted to microsoft.public.access.tablesdbdesign
Ken Snell \(MVP\)
external usenet poster
 
Posts: 2,506
Default Autonum problem

Does the append query contain the autonumber field as one of the output
fields? If so, remove that field from the output field list of the append
query -- the autonumber field will be assigned a value by the table when a
new record is added.

--

Ken Snell
MS ACCESS MVP


"Cathy" wrote in message
...
I have an autonum field in table1 that is the relational field to table2.
It
is an indexed field in table1 that will not allow duplicates, but is not
the
primary key. I need to add and delete records from both table from time
to
time. Recently I ran into a problem when I needed to add several records
to
table1. The append query kept trying to reuse a deleted autonum and would
error out. I had to rebuild the tables to make the process move forward
again. Why would it attempt to reuse a number instead of choosing the
next
highest number? Right now I don't have a lot of records so it wasn't too
much of a problem. It will be a problem if it does it again in the
future.
How can I prevent this error from happening in the future?

Thank you,
Cathy



  #3  
Old June 16th, 2008, 01:19 AM posted to microsoft.public.access.tablesdbdesign
Cathy
external usenet poster
 
Posts: 253
Default Autonum problem

Ken,

The append query does not have the autonumber field as an output field. I
expected to assign a new number. Instead it kept trying to assign an old,
deleted number. I've never had an autonum behave this way before... have you?

Thnks

"Ken Snell (MVP)" wrote:

Does the append query contain the autonumber field as one of the output
fields? If so, remove that field from the output field list of the append
query -- the autonumber field will be assigned a value by the table when a
new record is added.

--

Ken Snell
MS ACCESS MVP


"Cathy" wrote in message
...
I have an autonum field in table1 that is the relational field to table2.
It
is an indexed field in table1 that will not allow duplicates, but is not
the
primary key. I need to add and delete records from both table from time
to
time. Recently I ran into a problem when I needed to add several records
to
table1. The append query kept trying to reuse a deleted autonum and would
error out. I had to rebuild the tables to make the process move forward
again. Why would it attempt to reuse a number instead of choosing the
next
highest number? Right now I don't have a lot of records so it wasn't too
much of a problem. It will be a problem if it does it again in the
future.
How can I prevent this error from happening in the future?

Thank you,
Cathy




  #4  
Old June 19th, 2008, 02:03 AM posted to microsoft.public.access.tablesdbdesign
Ken Snell \(MVP\)
external usenet poster
 
Posts: 2,506
Default Autonum problem

Reuse of an "obsolete" number could indicate a corruption problem in the
database. Make a backup copy of the database, then run compact and repair on
the database. If that does not work, create a new database file and import
all the objects and data into that new file from the old file.

Another way that you might get this problem is if you append a record by a
query and that query has the autonumber field in the field list. ACCESS /
Jet will let you assign numbers to an autonumber field by an append query,
and this resets the seed of the autonumber field, which means it could then
start using old numbers if your query appended an old value into that field.

--

Ken Snell
MS ACCESS MVP


"Cathy" wrote in message
news
Ken,

The append query does not have the autonumber field as an output field. I
expected to assign a new number. Instead it kept trying to assign an old,
deleted number. I've never had an autonum behave this way before... have
you?

Thnks

"Ken Snell (MVP)" wrote:

Does the append query contain the autonumber field as one of the output
fields? If so, remove that field from the output field list of the append
query -- the autonumber field will be assigned a value by the table when
a
new record is added.

--

Ken Snell
MS ACCESS MVP


"Cathy" wrote in message
...
I have an autonum field in table1 that is the relational field to
table2.
It
is an indexed field in table1 that will not allow duplicates, but is
not
the
primary key. I need to add and delete records from both table from
time
to
time. Recently I ran into a problem when I needed to add several
records
to
table1. The append query kept trying to reuse a deleted autonum and
would
error out. I had to rebuild the tables to make the process move
forward
again. Why would it attempt to reuse a number instead of choosing the
next
highest number? Right now I don't have a lot of records so it wasn't
too
much of a problem. It will be a problem if it does it again in the
future.
How can I prevent this error from happening in the future?

Thank you,
Cathy






 




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 03:58 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.