Link to home
Start Free TrialLog in
Avatar of yballan
yballanFlag for United States of America

asked on

copy back a table with autonumber

Dear Experts,

I have a table with autonumber as index, but I allow the user to delete records randomly.
After that, I want to restore the table with autonumber without skipping, so I thought I could export the table without the autonumber field, then insert it back to the original structure.  As I am trying to do that, I get "invalid argument" error, and does not work.
How can I get my table to refresh, and get the autonumber in order as if I am entering the data as new?
Please advise.
Avatar of IrogSinta
IrogSinta
Flag of United States of America image

What is your purpose in re-sequencing the autonumber field?  That would be very inefficient to do every time a record is deleted.

Ron
Avatar of yballan

ASKER

More information:
In attempt to troubleshoot my query, I trimmed it down to just inserting one field, then I got a different error, looking for a mdb file.
But I am using Access 2010, my files are called XXX.accdb, and it is stored in a totally different folder from what the error message says.
I am extremely puzzled, please advise.
Untitled.jpg
Avatar of yballan

ASKER

Dear IrogSinta,

Thank you for your quick reply, I use the index for traversing forward and backward, and I find it easier to link everything if autonumbered index is in order.
This is meant to be as refreshing the table, and not supposed to happen often.
SOLUTION
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of yballan

ASKER

Dear feyd and IrogSinta,

I appreciate your educating me for this error, I do realize that I am trying to force something that is not quite right.  I have inherited this large amount of code, and since I am short of time, I did not want to rewrite all of the traversing codes.  I understand that there is something fundamentally flawed with the design of the original code, and what I really should do is to understand it, and correct it.

Once I get through this deadline, I will rewrite this, I do believe that it will cause other problems as you said.
Thank you for the correct SQL script.